You are here: Re: Get HTML title « All PHP « IT news, forums, messages
Re: Get HTML title

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];
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация