--- ".$timestamp." ".getRealIpAddr()." ---"; /* Open a file for writing */ $fp = fopen($fileName, "a") or die("can't open file"); // fwrite($fp, $timestamp); // fwrite($fp, "\n"); /* Read 8 KB stream each time and write to the file */ while ($data = fread($HTTPSTREAM, 8192)) fwrite($fp, $data); /* Close the streams */ fclose($fp); fclose($HTTPSTREAM); copy($fileName,"data/".$fileName.".xml"); copy($fileName,"data/".$fileName.".txt"); unlink($fileName); echo "Welcome to the general Receiver utility.
"; echo "Each time this URL is accessed, the script writes all recieved HTTP POST data (even if none is sent) to 2 identical files:

"; echo "date - timestamp - IP address.xml
"; echo "date - timestamp - IP address.txt

"; echo "These logs are located at "; echo ("http://**MyDomainOrIP**/receiver/data"); function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } ?>