Alright here is my code in php tags:
This is the forecast cron job.
<?php
set_time_limit(60);
//Stevens Weather
copy("http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=96&interval=6&lat=47.75&lon=-121.09", "stvns_wthr.xml");
sleep(20);
set_time_limit(60);
copy("http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=96&interval=6&lat=47.43&lon=-121.41", "snoq_wthr.xml");
sleep(20);
set_time_limit(60);
copy("http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=96&interval=6&lat=47.28&lon=-120.42", "mssn_wthr.xml");
sleep(20);
set_time_limit(60);
copy("http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=96&interval=6&lat=45.34&lon=-121.72", "baker_wthr.xml");
sleep(20);
set_time_limit(60);
copy("http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=96&interval=6&lat=46.9&lon=-121.51", "crstl_wthr.xml");
?>
Here is one of the webcam scripts.
<?php
set_time_limit(60);
//Stevens Webcams
copy("http://www.stevenspass.com/Stevens/SiteAssets/_ftp/webcam/stevenspass.jpg", "stevenspass.jpg");
sleep(10);
set_time_limit(60);
copy("http://www.stevenspass.com/Stevens/SiteAssets/_ftp/webcam/stevenspass2.jpg", "stevenspass2.jpg");
sleep(10);
set_time_limit(60);
copy("http://images.wsdot.wa.gov/us2/Stevens/sumteast.jpg", "sumteast.jpg");
sleep(10);
set_time_limit(60);
copy("http://images.wsdot.wa.gov/us2/stvldg/sumtwest.jpg", "sumtwest.jpg");
?>
So my questions again are:
1) Are the set time limit statements necessary for keeping the script from timing out if I have no access to the php.ini to change timeout length?
2) How should I implement error handling that retries the fetching of a file if it fails? My first guess is a try/catch, but I havent used those before.
Thanks.
-Chris