Here is the code. If I just substitute the path from '/index.php' to '/index.html' the response is instant.
function GetToHost($host,$port,$path)
{
$fp = fsockopen($host,$port);
if($fp) {
fputs ($fp , "GET $path HTTP/1.1\r\n");
fputs ($fp , "Host: $host\r\n");
fputs ($fp , "Connection: Close\r\n\r\n");
while (!feof ($fp )) {
$res .= fgets ($fp ,128 );
}
//printf ("Done!\n");
fclose ($fp );
return $res ;
} else {
return "There is a problem connecting to the server.";
}
} //End function
$host = '127.0.0.1';
$port = "80";
$path = "/index.php?name=testname";
$result = GetToHost($host,$port,$path,$data_to_send);
print $result;
Thanks!