Re: Re: getting HTML header from URL [solved]

From: 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:
oops 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; }
     }
     return $rline;
     }
fclose($file); }
1) What if this line looks like:
    <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
jslootbeek@clarku.edu

« previous php.general (#122491) next »