$ch = curl_init('http://www.domain.com/path/to/image'); $fp = fopen('/local/path//upload/tn/'.$image_id.'.jpg', 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_exec($ch); curl_close($ch); fclose($fp);