Re: Re: getting HTML header from URL [solved]
| From: | Jule Slootbeek | Date: | Sat, 02 Nov 2002 02:56:14 +0000 |
| Subject: | Re: Re: getting HTML header from URL [solved] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122491@lists.php.net to get a copy of this message | ||
yeah i just noticed that myself too,
and unfortunatly people do code their html like that..
J
On Friday, Nov 1, 2002, at 21:44 US/Eastern, David U. wrote:
Jule Slootbeek wrote:jslootbeek@clarku.eduoops didn't catch two little bugs Jule function getTitle($url) { $file = @fopen($url, 'r'); if(!$file) { $rline = "Error, contact webmaster"; } else { while (!feof ($file)) { $line = fgets($file); if (substr_count(strtoupper("$line"), "<TITLE>") >= 1) { $rline = strip_tags("$line"); //return $rline; //fclose($file); break; }1) What if this line looks like:} return $rline; }fclose($file); }<html><head><title>foo</title></head><body>bar</body></html>Wont' $rline == "foobar" ? 2) Can't you use a socket and read until the first <TITLE>start saving until the </TITLE> and close the socket? -davidu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jule Slootbeek