<?php function download_remote_file_with_curl($file_url, $save_to) { $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch,CURLOPT_URL,$file_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $file_content = curl_exec($ch); curl_close($ch); $downloaded_file = fopen($save_to, 'w'); fwrite($downloaded_file, $file_content); fclose($downloaded_file); } download_remote_file_with_curl('http://www.baiduyo.comhttp://www.zhouxiaodong.com/public/resources/uploads/20170411/20170411192556_35129.png', realpath("./downloads") . '/file.jpg'); ?>