Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Practical PHP Programming -- Can't open remote file

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
chriswadams



Joined: Tue Dec 01, 2009 12:54 am
Posts: 26

PostPosted: Thu Aug 12, 2010 1:47 am    Post subject: Practical PHP Programming -- Can't open remote file Reply with quote

Hey everyone --

I'm working through the "Practical PHP Programming" book on TuxRadar, and found this snippet of code (at http://www.tuxradar.com/practicalphp/8/14/0):

Code:

<?php
    $slash = fopen("http://www.slashdot.org", "r");
    $site = fread($slash, 200000);
    fclose($slash);
    print $site;
?>


The book says:

Quote:

"Try saving the above code into a file, "openremote.php", and loading it into your web browser - you should see Slashdot displayed",


but when I did that, I got nothing but a blank screen. I changed "www.slashdot.org" to a local file, and that worked fine, but no non-local files will display (except for one site, http://www.townhall.com/columnists, which only displayed the blue background of the title bar).

Does anyone have any suggestions as to why this code isn't working? Any input would be appreciated.

chriswadams.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast