HuyPV
Wednesday, October 28, 2009
curl = curl_init();
$options = array(CURLOPT_HEADER => 0,
CURLOPT_FOLLOWLOCATION => 1);
curl_setopt_array($curl, $options);
$fp = fopen($newFilePath, "wb");
$options = array(
CURLOPT_URL => $url,
CURLOPT_FILE => $fp,
CURLOPT_TIMEOUT => $timeOut);
curl_setopt_array($curl, $options);
curl_exec($curl);
fclose($fp);
if (curl_errno($curl)) {
unlink($newFilePath); //remove file
//echo curl_error($curl);
return false;
}
Title:
Download image file by cURL
Description:
curl = curl_init(); $options = array(CURLOPT_HEADER => 0, CURLOPT_FOLLOWLOCATION => 1); curl_setopt_array($curl, $options); $...
...
Rating:
4