note 1461 deleted from function.header by jimw
| From: | jimw@php.net | Date: | Wed, 31 Oct 2001 21:11:48 +0000 |
| Subject: | note 1461 deleted from function.header by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19720@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);
}