Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-30-2003, 05:09 PM   PM User | #1
Neno
New Coder

 
Join Date: Aug 2003
Posts: 87
Thanks: 0
Thanked 1 Time in 1 Post
Neno is an unknown quantity at this point
fopen(), fwrite() on a remote file

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...

Any suggestions?

Thanks,

Neno
__________________
Neno
Neno is offline   Reply With Quote
Old 09-30-2003, 06:48 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
Through which protocol are you trying to write the remote file? It can't work over http, but over ftp it would be possible. If that doesn't work still, you could put a php script on the remote server which is responsible for the writing of files. This file you could then request through fopen("http...").

Apart from that, posting some of your code would be very helpful.
__________________
De gustibus non est disputandum.
mordred is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:38 AM.


Advertisement
Log in to turn off these ads.