|
Posted by Adam Plocher on 01/20/06 01:43
PHP has no way built in to do this (as far as I know). This will work
though, but note that fsockopen will not handle redirects properly.
Many large sites will do some sort of redirecting, too. for example,
www.google.com will not work with this example:
<?
$host="slashdot.org";
$buffer="";
$fp=fsockopen($host, 80);
fwrite($fp, "GET / HTTP/1.0\r\nHost: $host\r\n\r\n");
while (!feof($fp)) $buffer.=fread($fp, 4096);
fclose($fp);
//echo $buffer;
preg_match("/(<title>)(.*)(<\/title>)/", $buffer, $matches);
echo $matches[2];
?>
[Back to original message]
|