I have developed a little script that runs in the background, from the command line and starts off as a cron job every morning. I use fopen() function to check for the updates of some remote URLs. If the remote file is updated, the script uses fopen and fwrite to open / writes to the local file and change it accordingly. The file is located in my phpdev\www directory and, with help of eregi_replace I change it so it can be used to feed my database.
However, I have to upload this text file to the (remote) server every time and run different script thru the browser in order to update my database.
It would be hack of a lot better if I could fwrite to the text file on my remote server (skipping the manual upload), but, whenever I try to do that, die() function throws the error: "can't open the file"... I suspected permissions problems and changed the file and folder permissions (even to 777)... still it doesn't work. As a test, I have tried to fopen the document on my web site, but that also failed. I have checked php.ini on my machine and "allow_url_fopen" is set to "on". However, when I try fopen some document on different web site, it works...