$ch = curl_init();
$source = 'http://website.com/filename.jpg';
$path_parts = pathinfo('http://website.com/filename.jpg');
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
$source = 'http://website.com/filename.jpg';
$path_parts = pathinfo('http://website.com/filename.jpg');
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
// Your File Path and Filename here
echo $destination = "./fileuplods/".$path_parts['filename'].'.'.$path_parts['extension'];
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
No comments:
Post a Comment