Tuesday, 15 March 2011

curl - PHP: Save Dynamic URL Image to Disk -



curl - PHP: Save Dynamic URL Image to Disk -

having problem capturing next dynamic image on disk, 1k size file

http://water.weather.gov/precip/save.php?timetype=recent&loctype=nws&units=engl&timeframe=current&product=observed&loc=regioner

i have setup php curl feature work fine on static imagery, not work above link. similarly, re-create function, file_put_contents (file_get_contents)...they work fine static image. plenty of references in usage of these php functions, not details here. re-create command:

copy('http://water.weather.gov/precip/save.php?timetype=recent&loctype=nws&units=engl&timeframe=current&product=observed&loc=regioner', 'precip5.png');

behavior same, getting precip5.png size 760 bytes, on windows development box , linux staging box, can rule os issues out. again, php functions same thing - generate file - empty. command line curl programme generating same junk 1k file.

so, issue seems source , best can tell is dynamic (streaming?) image.

ideally, done in php or command line utility curl. trying avoid adding java (imageio) dependency this...until absolutely have have go there...

i trying understand nature of beast (the image) first ;-)...

the url saving produces html output, not image. missing parameter &print=1

http://water.weather.gov/precip/save.php?timetype=recent&loctype=nws&units=engl&timeframe=current&product=observed&loc=regioner&print=1

php curl

No comments:

Post a Comment