Reply to Can't read remote Web page from local Apache/PHP

Your name:

Reply:


Posted by dave_nul on 10/18/13 11:41

Hello. I'm trying to read the contents of any Web page on another
host. I'm finding that...

echo file_get_contents( 'http://www.php.net' );

.... works fine if I upload the PHP script to my Web host, and run it
there. But if I run it on my PC, which is running Apache 1.3.33
(Win32) and PHP 5.0.5, then it always times out, and gives me the error
message...

[error] PHP Warning: file_get_contents(http://www.php.net) [<a
href='function.file-get-contents'>function.file-get-contents</a>]:
failed to open stream: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.

I get the exact same results using...

$fh = fopen( 'http://www.php.net', 'r' ) or die( $php_errormsg );
while (! feof($fh)) {
$page .= fread($fh,1048576);
}
fclose($fh);
echo $page;


Anyone know what could cause this to happen?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация