User's Ip Address

Retrieving User’s IP address


CHttpRequest::getUserHostAddress(); 

This will give you highly inaccurate results for lots of users that are using VPN’s, company’s proxy/firewall and more… .

I’ve written back then an extension that includes a handy method that gives more accurate results back. If you’re interested, check out PcMaxmindGeoIp extension and in specific, the method getRemoteIpAddress() provided by it.