Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. curl_setopt($curlDl, CURLOPT_URL, $url);
  3. curl_setopt($curlDl, CURLOPT_RETURNTRANSFER, true);
  4. curl_setopt($curlDl, CURLOPT_BINARYTRANSFER, true);
  5. curl_setopt($curlDl, CURLOPT_HEADER, FALSE);
  6. curl_setopt($curlDl, CURLOPT_CONNECTTIMEOUT, 600);
  7. curl_setopt($curlDl, CURLOPT_COOKIEJAR, getcwd() . '/cookie.txt');
  8. curl_setopt($curlDl, CURLOPT_COOKIEFILE, getcwd() . '/cookie.txt');
  9.  
  10. // get the URL
  11. try {
  12. $mp3 = curl_exec($curlDl);
  13.  
  14. $retcode = curl_getinfo($curlDl, CURLINFO_HTTP_CODE);
  15.  
  16. if ($retcode == 200) {
  17. $fp = fopen ($location . $file, 'w+b');
  18. $fwrite = fwrite($fp, $mp3);
  19. if ($fwrite === false) {
  20. fclose($fp);
  21. return false;
  22. }
  23. fclose($fp);
  24. }
  25.  
  26. // curl_setopt($curlDl, CURLOPT_FILE, $fp);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement