I have two pages, one sending a file_get_contents request:
$postdata = http_build_query( array('install' => 'true', 'url' => $_SERVER['SERVER_NAME'], 'key' => 'XXXXXXXXXXXX') );
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$registration_key = file_get_contents('http://example.com/register.php', false, $context);
And a page that receives the call (http://example.com/register.php) and I am trying to grab the IP of where the request is coming from to no avail. I have tried:
$_SERVER['HTTP_CLIENT_IP']
$_SERVER['HTTP_VIA']
$_SERVER['HTTP_X_FORWARDED_FOR']
$_SERVER['REMOTE_ADDR']
(IP, but not the IP of the computer sending OR receiving the request)
Any idea as to where I can find more info on the computer sending the request?
Thanks in advance!
Only if you will pass IP in request:
$registration_key = file_get_contents('http://example.com/register.php?ip='.$_SERVER['REMOTE_ADDR'], false, $context);