ulvis.paste.net

Paste Search Dynamic
Recent pastes
remonte donwload
  1. ?php
  2. $download_link = "
  3. http://example.com/file_01.zip
  4. http://example.com/file_02.zip
  5. http://example.com/file_03.zip
  6. http://example.com/file_04.zip
  7. http://example.com/file_05.zip
  8. ";
  9.  
  10. function remote_file_download($url, $save, $ssl = false)
  11. {
  12.         $ch = curl_init();
  13.         curl_setopt ($ch, CURLOPT_URL, $url);
  14.         curl_setopt ($ch, CURLOPT_HEADER, 0);
  15.         curl_setopt ($ch, CURLOPT_BINARYTRANSFER, true);
  16.         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  17.         if ($ssl == true) {
  18.                 curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
  19.         }
  20.         curl_setopt ($ch, CURLOPT_TIMEOUT, 50000);
  21.         $result = curl_exec ($ch);
  22.         curl_close ($ch);
  23.         $handle = fopen($save, 'w+');
  24.         fwrite($handle, $result);
  25.         fclose($handle);
  26. }
  27.  
  28. foreach(preg_split("/((\r?\n)|(\r\n?))/", $download_link) as $file_url)
  29. {
  30.         if ($file_url != "") { remote_file_download($file_url, basename($file_url), true); }
  31. }
  32. ?>
Parsed in 0.022 seconds