Hi All,

I am completely new to all this, so please bare with me.  I have
permission to use another person's text file which resides on his
server.  Currently I manually download the file, process it in Excel,
then upload it into my MySQL database.  I want to try to automate this
process, and the first step I see if getting the file from his server
onto mine for processing.  I will be using a cron job for this.

This is what I currently have, but I get errors...

$WebFile="http://www.somesite.com/somefile.txt";;
$LocalFile="/path/to/somefile.txt";

$handle = fopen ($WebFile, "r");
$outhandle=fopen ($LocalFile,"w");
while (!feof($handle)) {
$buffer=fread($handle,4096);
fputs($outhandle,$buffer);
}
fclose($handle);
fclose($outhandle);

When I try running this I get error after error:

Warning: fopen("http://www.somesite.com/somefile.txt","r";) - No error in
trial.php on line 5

Warning: Supplied argument is not a valid File-Handle resource in
trial.php on line 7

Warning: Supplied argument is not a valid File-Handle resource in
trial.php on line 8

The last two lines repeat themselves until the script times out.

Help!  I am desperate!!  The file definently exists but I am stuck.

Thank you,
Michael.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to