Forum Moderators: coopster
i am having a some difficulty with the following code;
PHP Code:$file = fopen ("$url", "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<TITLE>(.*)</TITLE>", $line, $out)) {
$title = $out[1];
break;
}
}
fclose($file);
It is doing its job perfectly on one seve I have - but on a new host I have - it seems to be causing the page it is reading, to be opened and executed over and over again. Can anyone here think of a fix - that will allow it to just read the file once - without executing the file.
Basically - this is reading the title tags of a page, and feeding this into a counter - that requires the page title (this is what $title is). $url is grabbed from the current page that has been opened up in the browser. And from there - is supposed to be read (not executed) - where the title can be grabbed, and passed to the counter.
Any help would be great!