Page 1 of 1

fopen Problem

Posted: Wed Nov 14, 2007 1:02 pm
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]

Posted: Wed Nov 14, 2007 6:43 pm
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...

Posted: Thu Nov 15, 2007 9:32 am
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.