Problem with Fopen

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sygnylmz
Forum Newbie
Posts: 1
Joined: Thu Oct 22, 2009 4:19 am

Problem with Fopen

Post by sygnylmz »

I'm trying to get the contents of an external file and display it on my page but the code doesn't seem to work. Do you have any idea what's the problem here? Thank you for your time.

Code: Select all

<?
 
$fd = fopen ("http://www.google.com", "r");
while (!feof ($fd)) {
$yaks= fgets($fd, 4096);
echo $yaks;
}
fclose ($fd);
 
?>
 
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: Problem with Fopen

Post by markusn00b »

Do you receive any errors? What *does* happen? What *doesn't* happen?

My guess is that your PHP configuration has allow_url_fopen set to off.
Post Reply