kotvalera83

php script to download a file on a remote server and save lo

Apr 2nd, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. $ch = curl_init();
  2. $source = "http://someurl.com/afile.zip";
  3. curl_setopt($ch, CURLOPT_URL, $source);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  5. $data = curl_exec ($ch);
  6. curl_close ($ch);
  7.  
  8. $destination = "/asubfolder/afile.zip";
  9. $file = fopen($destination, "w+");
  10. fputs($file, $data);
  11. fclose($file);
Add Comment
Please, Sign In to add comment