sammeras Posted May 24, 2008 Share Posted May 24, 2008 Hello, I am new at php. I am trynig to download image to my server (OR to my local computer). The images located at: http://pms.panet.co.il/online/images/music_new/222.jpg[/b]]http://pms.panet.co.il/online/images/music_new/222.jpg How can download it with php code? Best regards, SAM. Quote Link to comment Share on other sites More sharing options...
minidak03 Posted May 24, 2008 Share Posted May 24, 2008 I've done this with zip files but it might be slightly different with images but you can give it a shot. <?php $url = "URL_TO_IMAGE"; $ext = substr(strrchr($url, '.'), 1); $imgData = file_get_contents($url); $myFile = "image_name.".$ext; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $imgData); fclose($fh); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.