Forum Moderators: coopster
For example, it works for: -http://www.example.com/
and it doesn't work for: -http://www.example.com/test/
I open a connection to -http://www.example.com/ with fsockopen() and then I use:
@fputs($fp, "HEAD ".$url_path." HTTP/1.0\r\n");
where $url_path is either '/' or '/test/' for my 2 examples.
What's the problem?
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "HEAD /test/ HTTP/1.0\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fputs($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
?>
Seems to work on my site.
GGG