fopen Problem

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
tnewman
Forum Newbie
Posts: 2
Joined: Wed Nov 14, 2007 12:56 pm

fopen Problem

Post by tnewman »

scottayy | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

<?php
$queryString= $_GET["CategoryID"];
$requestingPage="http://www.ProfessionalLinkBuilding.com/Directory.aspx?CategoryID=".$queryString;
$file = fopen ($requestingPage, "r");
while (!feof ($file)) echo fgets ($file, 1024);
fclose($file);
?>
is giving me this error:

This is the error

Code: Select all

Warning: fopen(http://www.professionallinkbuilding.com/directory.aspx?CategoryID=) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/mayfair/public_html/TopList.php on line 4

Warning: feof(): supplied argument is not a valid stream resource in /home/mayfair/public_html/TopList.php on line 5

Warning: fgets(): supplied argument is not a valid stream resource in /home/mayfair/public_html/TopList.php on line 5
Can someone please help me out? The Php variable allow_url_fopen is on in the server.

Thank you!


scottayy | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Bogey
Forum Commoner
Posts: 34
Joined: Sat Nov 10, 2007 5:51 pm

Post by Bogey »

I use the following code to open a file... although I think it doesn't make any difference to the code you are using...

Code: Select all

$filename2 = 'pages/'. $_FILES["file"]["name"] .'.php';
$fp2 = fopen('"$filename2", "w");
That's in creating a file though...
moleculo
Forum Newbie
Posts: 18
Joined: Thu Nov 15, 2007 9:05 am

Post by moleculo »

I'm having a similar problem. I tried changing the public_html permissions from 750 to 755 to 777, but that didn't work, and that also created a bigger problem where php was unable to read from mysql. I had to contact my webhost and somehow it got fixed later. I don't know how. I don't have a solution, but I think it might have to do with server permissions, for whatever it's worth.
Post Reply