Created
June 20, 2016 20:17
-
-
Save phsantiago/bdabe38398e66467475dc74261274b8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function ocDownloadImg($url){ | |
$filename = end(explode('/', $url)); | |
$saveIn = DIR_IMAGE . '/downloaded/' . $filename; | |
$ch = curl_init($url); | |
$fp = fopen($saveTo, 'wba'); | |
curl_setopt($ch, CURLOPT_FILE, $fp); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_exec($ch); | |
curl_close($ch); | |
fclose($fp); | |
return 'downloaded/' . $filename; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment