How to Save image in PC from a remote site Using PHP -


hey using php script generate random captcha image remote website want save images in c:\inetpub\wwwroot\sav\

how

<?php $id= rand(11111,99999); ?> <img src="http://jeemain.nic.in/jeemain2013/myhandler/displaycaptchaimg.ashx?value=<?php echo $id; ?>" alt="image"> 

i want save image in directory ../sav/ , name images $id.jpg example $id= '22222' image named 22222.jpg

well, assuming mean want save images on same machine running php...

<?php     $id = rand(11111,99999);     $source = "http://jeemain.nic.in/jeemain2013/myhandler/displaycaptchaimg.ashx?value=" + $id;     $target = "c:/inetpub/wwwroot/sav/{$id}.jpg";     $img = file_get_contents($source);     file_put_contents($target, $img); ?> 

note attempt save file on same machine running php - is, server not desktop (unless they're both same machine).


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -