KeziaKristina
Programmer
How can i get/read a header of url ?
I have try this function,
function get_headers($host, $path = "/"

{
$fp = fsockopen ("$host", 80, &$errnr, &$errstr) or die("$errno: $errstr"

fputs($fp,"GET $path HTTP/1.0\n\n"

while (!$end)
{
$line = fgets($fp, 2048);
if (trim($line) == ""

$end = true;
else
echo $line;
}
fclose($fp);
}
sometimes it doesn't work sometimes it works, but it display a warning message
Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect failed in ....
Warning: fsockopen() [function.fsockopen]: unable to connect to prdownloads.sourceforge.net:80 in ...