Hi,
I've used fopen() extensively to open web pages. I've found that there is a
small minority
of web pages that open fine in a browser, but are inaccessible using
fopen(). Here are
two such URLs:
http://www.homes.com/
http://www.dolbyproperties.com/
For example, using the code below, almost every web page that will open in a
browser
will be read correctly by this code. There are few exceptions, such as the
above URLs.
I'm wondering why/how could a page be accessible to a browser but not to
fopen()?
Here's the code:
<?php
$page = "";
if (isset($url))
{
$fp = fopen($url, 'r');
if ($fp != false)
{
while (feof($fp) == false)
{
$page .= fread($fp, 10000);
}
fclose($fp);
echo "URL: $url =====================================<br><br>";
echo $page;
}
}
?>
I have this code running with a simple form interface here:
http://linkmachine.net/fopen_test.php
Any ideas?
Thank you,
-Michael