CRON JOB - How to grab image from URL ...servlet/byvejr_dag1?by=5466&mode=long -


i want save image server cron job url: http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=5466&mode=long - png image i've tried following codes

*/5 *   *   *   *   curl http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=5466&mode=long > /home/klintweb/public_html/gal.klintmx.dk/images/vejr.png 

the image saved in folder, can't published because of error - file-size 0 byte there way this

the job done php script

$profile_image = 'http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=5466&mode=long'; //image url $userimage = 'byvejr_dag1_5466.png'; // renaming image $path = '/home/klintweb/public_html/gal.klintmx.dk/images/vejr';  // saving path $ch = curl_init($profile_image); $fp = fopen($path . $userimage, 'wb'); curl_setopt($ch, curlopt_file, $fp); curl_setopt($ch, curlopt_header, 0); $result = curl_exec($ch); curl_close($ch); fclose($fp); 

and cron job

0,30    *   *   *   *   /usr/bin/php /home/klintweb/public_html/gal.klintmx.dk/byvejr.php 

and .htaccess in folder images/vejr make sure it's not cached

<ifmodule mod_expires.c> # disable caching forthis directory mod_expires directory expiresactive off </ifmodule> 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -