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 !! Quote 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 Quote 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. Quote 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 ? Quote 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. Quote 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/73444-file_get_contents/#findComment-370533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.