This above code entry does NOT just open the first 8k.. Consider:
Code:
<?php
error_reporting(E_ALL);
function auto_title_http_get($url){
$url_stuff = parse_url($url);
$port = isset($url_stuff['port']) ? $url_stuff['port'] : 80;
$fp = fsockopen($url_stuff['host'], $port);
$query = "GET " . $url_stuff['path'] ."?". $url_stuff['query'] . " HTTP/1.0\n";
$query .= "Host: " . $url_stuff['host'];
$query .= "\n\n";
fwrite($fp, $query);
while ($tmp = fread($fp, 8192))
{
$buffer .= $tmp;
}
preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts);
return substr($buffer, - $parts[1]);
}
echo auto_title_http_get('http://fedora.inode.at/6/i386/iso/FC-6-i386-DVD.iso');
?>
And watch your servers memory get gobbled up and and PHP timeout.. Hence why fopen is preferred.