From The Blog

CakePHP: Get Client's IP Address

27 October 2012, in CakePHPPHP

in CakePHP 1.x

Through the RequestHandler Component:

RequestHandlerComponent::getClientIp();

in CakePHP 2.x

RequestHandler::getClientIp() is deprecated, so you can use the CakeRequest object

$this->request->clientIp();

 

of course you can still use the server variable   $_SERVER['REMOTE_ADDR']



Post a Comment