d.shankar Posted October 16, 2007 Share Posted October 16, 2007 I need to open the source(html) of the site www.google.com with file_get_contents , but it does not seem to work. Any help ? <?php $value=file_get_contents("http://www.google.com"); echo $value; ?> But shows only a blank white page !! Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/ Share on other sites More sharing options...
sspoke Posted October 16, 2007 Share Posted October 16, 2007 works for me. just image downs and links don't work because they link up locally Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370491 Share on other sites More sharing options...
d.shankar Posted October 16, 2007 Author Share Posted October 16, 2007 Really ? What did u get ? for me it just shows a blank page. Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370492 Share on other sites More sharing options...
d.shankar Posted October 16, 2007 Author Share Posted October 16, 2007 Could somebody tell me whats the problem is ? Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370501 Share on other sites More sharing options...
d.shankar Posted October 16, 2007 Author Share Posted October 16, 2007 This is the code <?php $content=file_get_contents("http://www.google.com",FALSE,NULL,0,20); echo $content; ?> I am getting this error Warning: file_get_contents(http://www.google.com) [function.file-get-contents]: 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. in C:\wamp\www\tested.php on line 2 allow_url_fopen is set to On in my php.ini. Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370510 Share on other sites More sharing options...
d.shankar Posted October 16, 2007 Author Share Posted October 16, 2007 If i use the code below i dont get an error <?php $content=file_get_contents("http://localhost"); echo $content; ?> Only if i use a remote host i get errors. Any ideas for this problem ? Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.