fopen won't work with url but works with server path
Posted: Tue Aug 16, 2005 6:46 pm
Hi,
I have a problem with the following code:
If $siteurl is a URL, such as http://www.myserver.com/feeddirectory/, then I get the error "can't open file". The URL that is echoed by the script is correct, if I copy and paste the URL in my webbrowser it displays the xml file.
The same script works if I use the local path on the server instead, ie. /usr/home/feeddirectory/, but that's not really an option for my script.
allow_url_fopen is set to 'on' on the server. What's more, the same problem occurs on my local testserver (windows xp) and on my remote server (linux). The above php code and the feed.xml file are in different directories on the server but I don't really see how this could cause the problem.
Does anyone have any ideas, because this is starting to drive me nuts.
Thank you for your replies.
Stefan
I have a problem with the following code:
Code: Select all
$myFile = $siteurl."feed.xml";
echo "myfile: $myFile";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $feeddata);
fclose($fh);The same script works if I use the local path on the server instead, ie. /usr/home/feeddirectory/, but that's not really an option for my script.
allow_url_fopen is set to 'on' on the server. What's more, the same problem occurs on my local testserver (windows xp) and on my remote server (linux). The above php code and the feed.xml file are in different directories on the server but I don't really see how this could cause the problem.
Does anyone have any ideas, because this is starting to drive me nuts.
Thank you for your replies.
Stefan