Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl_setopt($curlDl, CURLOPT_URL, $url);
- curl_setopt($curlDl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curlDl, CURLOPT_BINARYTRANSFER, true);
- curl_setopt($curlDl, CURLOPT_HEADER, FALSE);
- curl_setopt($curlDl, CURLOPT_CONNECTTIMEOUT, 600);
- curl_setopt($curlDl, CURLOPT_COOKIEJAR, getcwd() . '/cookie.txt');
- curl_setopt($curlDl, CURLOPT_COOKIEFILE, getcwd() . '/cookie.txt');
- // get the URL
- try {
- $mp3 = curl_exec($curlDl);
- $retcode = curl_getinfo($curlDl, CURLINFO_HTTP_CODE);
- if ($retcode == 200) {
- $fp = fopen ($location . $file, 'w+b');
- $fwrite = fwrite($fp, $mp3);
- if ($fwrite === false) {
- fclose($fp);
- return false;
- }
- fclose($fp);
- }
- // curl_setopt($curlDl, CURLOPT_FILE, $fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement