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