From The Blog

CakePHP: Get Client's IP Address

27 October 2012, in

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

PHP: client's IP address

27 October 2012, in

The IP Address of the client who sent HTTP request is stored in the server variable:

$_SERVER['REMOTE_ADDR'];



Post a Comment