Following code shows how to get an image file by providing an URL and to save it in the local drive. function file_get_contents_curl($url) { $file_data=array('data'=>null,'info'=>array('http_code'=>null)); $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $file_data['data'] = curl_exec($ch); if (!curl_errno($ch)) { $info = curl_getinfo($ch); $file_data['info'] = $info; ...
Comments
Post a Comment