GameOn
12-18-2008, 03:10 AM
I want to automate downloading a data file that I get from a webserver once or more each day. If I get it to my pc I can then upload and then parse it to the MySQL database on my web server. In a perfect world, I would skip having to put in on my pc and go directly from the server it is on to the one I am on.
The Linux server I am on runs Apache and has PHP and perl (although I do not know much about perl). I have Visual Studio .Net on my PC.
I currently do not have access to /etc/cron.daily or /etc/crontab, although if it is necessary my hosting company may let me drop a script there.
Update:
I forgot I do have this available...
Standard Cron Manager
This is a web interface to the crontab program. It allows you to run commands at any time you specify. Enter the command you would like to run as well as running times.
Please enter an email address where the cron output will be sent:_____ It then allows me to select a frequency.
So now that I found the cron job, this is pretty easy.
I set up the cron to run once everyday. It points to a php file with this code
#!/usr/bin/php
<?php
$file = file_get_contents("http://www.ZZZZ.com/path/info.txt");
file_put_contents("/myPath/myInfo.txt", $file);
?>
This puts in on my server where I can now set up another script to parse it and update my database.
OK, today I got an error. I think it is because the file is too big...
PHP Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 18721732 bytes) in /myPath/myScript.php on line 4
The Linux server I am on runs Apache and has PHP and perl (although I do not know much about perl). I have Visual Studio .Net on my PC.
I currently do not have access to /etc/cron.daily or /etc/crontab, although if it is necessary my hosting company may let me drop a script there.
Update:
I forgot I do have this available...
Standard Cron Manager
This is a web interface to the crontab program. It allows you to run commands at any time you specify. Enter the command you would like to run as well as running times.
Please enter an email address where the cron output will be sent:_____ It then allows me to select a frequency.
So now that I found the cron job, this is pretty easy.
I set up the cron to run once everyday. It points to a php file with this code
#!/usr/bin/php
<?php
$file = file_get_contents("http://www.ZZZZ.com/path/info.txt");
file_put_contents("/myPath/myInfo.txt", $file);
?>
This puts in on my server where I can now set up another script to parse it and update my database.
OK, today I got an error. I think it is because the file is too big...
PHP Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 18721732 bytes) in /myPath/myScript.php on line 4