I've got the following script (basically picked up from the php manual with the url changed)
$fp = fsockopen("www.strategicdata.co.nz", 80, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.0\r\n";
$out .= "Host: www.strategicdata.co.nz\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
With Apache on Windows it returns the right response:
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in C:\Apache2\htdocs\fsockopen.php on line 2
Warning: fsockopen(): unable to connect to [url]www.strategicdata.co.nz:80[/url] in C:\Apache2\htdocs\fsockopen.php on line 2
The operation completed successfully. (0)
But on Apache Linux it fetches the web page of the web designer. Can anyone tell me why when there is no site at all, it returns a file pointer on Linux