How can I get the client\'s IP address in CakePHP? It\'d be $_SERVER[\'REMOTE_ADDR\'] in plain PHP.
$_SERVER[\'REMOTE_ADDR\']
I thought it\'s like all $_SERVER vars
$_SERVER
You can use $this->request->clientIp(); to get the current visitor's IP address.
$this->request->clientIp();
Cake\Http\ServerRequest::clientIp() Returns the current visitor’s IP address.
For further reference https://book.cakephp.org/3.0/en/controllers/request-response.html#reading-http-headers