How can I get the client's IP address in a PHP webservice?

ip-address, logging, php, web-services

Solution

This should be what you want:

$_SERVER['REMOTE_ADDR']

The IP address from which the user is viewing the current page.

http://php.net/manual/en/reserved.variables.server.php

Problem

I have developed a PHP webservice. I would like to log all incoming connections of the WS clients, which are consuming this web service. How can I obtain the client's IP address? The value of ``` $_SERVER['HTTP_CLIENT_IP'] ``` seems to be always empty.

Original source

Related problems