Forum Moderators: coopster

Message Too Old, No Replies

Downloading remote file

         

ajs83

9:43 pm on Mar 21, 2006 (gmt 0)

10+ Year Member



I have the following code that logs into a site I have an account on and checks a file with a given url. They have recently modified the site and now package them in zip file.

Now I need to update the script to save the file to my server where I can open up and access the zip file contents.

I've got this much working (snippet below) where it logs in and accesses the url. Upon doing so it returns REPORTS.ZIP, but that is where my knowledge runs out. I don't know what I need to do to save the file to my server.

After it is on my server I can easily open and read the zip file, but I don't know how to get it there. I haven't dealt with this before so I'm not sure what to do and would appreciate any suggestions that you can offer.

//=============================User Login =====================================
$obj = new loader; // for letter page
$obj->load('http://www.example.com');
$obj->post = array('field1' => $field1, 'field2' => $field2);
$obj->load("http://www.example.com/loginok");
$obj->load("http://www.example.com/filehub");
//============================= Process Data =====================================
$lnk = "http://www.example.com/file.php?date=2006/01/18&date2=2006/01/19&file=REPORTS&info=all";
$obj->load($lnk);

Thanks

seanpecor

12:13 pm on Mar 22, 2006 (gmt 0)

10+ Year Member



Refer to [us3.php.net...] - if I understand your question you want to take the file's data stored in a variable and save it to your server? If so the fwrite() examples will help you.

Once you have the zip do you need to know how to unzip it such that your scripts can access the uncompressed data? If so, I can help just let me know.

Sean

ajs83

8:21 pm on Mar 22, 2006 (gmt 0)

10+ Year Member



Thanks,

Once the file is on my server I have a script to open it, I just have to find a way to get it there.