problem with file()
| From: | Thierry Frey | Date: | Wed, 17 Oct 2001 14:54:08 +0000 |
| Subject: | problem with file() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71338@lists.php.net to get a copy of this message | ||
Hello,
I want to open a remote URL and store it in an aray to search for a
particular pattern. It seems to me that file() is the function to use. I
have tried the example given in the manual
<?
$fcontents = file ('http://www.php.net');
if ($fcontents) {
while (list ($line_num, $line) = each ($fcontents)) {
echo "<b>Line $line_num:</b> " . htmlspecialchars ($line) .
"<br>\n";
}
} else {
echo "file() returned an error <br>";
}
?>
but I always get the following output
Warning: file("http://www.php.net") - No error in
d:\web_content\test_file.php on line 2
file() returned an error
Does anyone have a clue?
Thanks,
Thierry