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. Link to comment https://forums.phpfreaks.com/topic/107046-download-image-to-my-server-with-php/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/107046-download-image-to-my-server-with-php/#findComment-548748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.