Practical PHP Programming -- Can't open remote file

Code junkies hangout here

Moderators: ChriThor, LXF moderators

Practical PHP Programming -- Can't open remote file

Postby chriswadams » Thu Aug 12, 2010 12:47 am

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: Select all
<?php
    $slash = fopen("http://www.slashdot.org", "r");
    $site = fread($slash, 200000);
    fclose($slash);
    print $site;
?>


The book says:

"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.
chriswadams
 
Posts: 27
Joined: Tue Dec 01, 2009 12:54 am

Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests