note 1461 modified in header by ronabop
| From: | ronabop@php.net | Date: | Sun, 01 Oct 2000 06:44:21 +0000 |
| Subject: | note 1461 modified in header by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5749@lists.php.net to get a copy of this message | ||
Reading header of URL
php does not support reading header function. you must open socket directly. Following is the
function to read URL header. (see http://www.phpwizard.net/phpTidbits/)
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);
}
http://www.php.net/manual/function.header.php