The last script is a bot script that's supposed to simulate the same post as the second script :
Code:
$sock = fsockopen($URL, 80, $errno, $errstr);
fputs($sock, "POST $script HTTP/1.1\r\n");
fputs($sock, "Host: $URL\r\n");
fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($sock, "Content-length: " . strlen($data) . "\r\n");
fputs($sock, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11\r\n");
fputs($sock, "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n");
fputs($sock, "\r\n");
fputs($sock, "$data\r\n");
fputs($sock, "\r\n");
while (!feof($sock)){
$result .= fgets($sock, 128);
}
print($result);
fclose($sock);
which returns :
Code:
HTTP_HOST = www.myfhg.com
CONTENT_TYPE = application/x-www-form-urlencoded
CONTENT_LENGTH = 25
HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
HTTP_ACCEPT = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
PATH = /sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE =
SERVER_SOFTWARE = Apache
SERVER_NAME = www.myfhg.com
SERVER_ADDR = 72.55.179.76
SERVER_PORT = 80
REMOTE_ADDR = 72.55.179.76
DOCUMENT_ROOT = /home/www
SERVER_ADMIN = root@localhost
SCRIPT_FILENAME = /home/www/www.myfhg.com/Lab/Server.php
REMOTE_PORT = 41244
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
REQUEST_METHOD = POST
QUERY_STRING =
REQUEST_URI = /Lab/Server.php
SCRIPT_NAME = /Lab/Server.php
PHP_SELF = /Lab/Server.php
REQUEST_TIME = 1200056719
WHY ARE THE RESPONSE DIFFERENT ?
How does the remote server spot my robot ? and how can I fix this ?