/ Published in: PHP
Expand |
Embed | Plain Text
<?php function saveImage($path) { $ch = curl_init ($path); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $img = curl_exec ($ch); curl_close ($ch); } saveImage('http://nettuts.s3.cdn.plus.org/513_jsFromNull/javascript-from-null.jpg'); ?>
Comments
Subscribe to comments
You need to login to post a comment.

This is a handy little function that I needed for a project several months ago. By calling the "saveImage" function, and passing in a path to an image, it will save the image to your server. Make sure that you modify the "fopen" section if the image should be stored in some specific folder.