:
This message was edited by melissa_may1 at 2007-4-12
: 8:7:44
: Hi All:
:
: I'm sure you all can clear up my confusion easily!
:
: What happens between the webserver and the client when the user
: types a URL that returns a data file? As a result of typing the URL,
: the browser pops up a "File Download" dialog, and asks "Do you want
: to open or save this file?"
:
: Here's what I'm trying to do: I want to automate the download of a
: data file that I get from a webserver daily. Now I manually download
: the data file to my workstation, then run a program that parses the
: data file and puts the data into a MySQL database.
:
: I have a webserver with Apache and MySQL and PHP all set up.
:
: I have a PHP script that I use for users on a website to upload
: files to the server, but that's not what need...
:
: Can I use PHP to do this? Can anyone give me some tips on where to
: start? I'm so confused!
:
: Thanks!
:
:
:
Melissa
:
:
If you have a linux workstation, place a script in /etc/cron.daily/ or configure your /etc/crontab to point to your downloading script.
in PHP:
#!/usr/bin/php
$data = file_get_contents("http://address.to.data/myData.file");
file_put_contents("/tmp/myData.file", $data);
system("php my_data_processing_script.php /tmp/myData.file");
in shell script:
#!/bin/sh
wget http://address.to.data/myData.file -O /tmp/myData.file
php my_data_processing_script.php /tmp/myData.file