fork download
  1. <?php
  2. $url = 'http://i...content-available-to-author-only...r.com/7WMNE4f.mp4';
  3. $curl = curl_init($url);
  4.  
  5. $file = fopen(__DIR__ . "/" . strip(parse_url($url, PHP_URL_PATH)) . "." . getMime($url), "w");
  6.  
  7. curl_setopt($curl, CURLOPT_FILE, $file);
  8. curl_exec($curl);
  9. curl_close($curl);
  10. fclose($file);
  11.  
  12.  
  13.  
  14. function getMime($url) {
  15. $curl = curl_init($url);
  16. curl_setopt($curl, CURLOPT_HEADER, 1);
  17. curl_setopt($curl, CURLOPT_NOBODY, 1);
  18. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  19. curl_exec($curl);
  20.  
  21. $mime = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
  22. $mime = preg_split("/\\//", preg_split("/;/", $mime)[0])[1];
  23.  
  24. curl_close($curl);
  25.  
  26. return $mime;
  27. }
  28.  
  29. function strip($path) {
  30. $path = preg_split("/\\//", $path);
  31. $path = preg_split("/\\./", $path[count($path)-1])[0];
  32. return $path;
  33. }
Success #stdin #stdout #stderr 0.01s 55776KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined offset: 1 in /home/4sc1CK/prog.php on line 22
PHP Warning:  fopen(/home/4sc1CK/7WMNE4f.): failed to open stream: Permission denied in /home/4sc1CK/prog.php on line 5
PHP Warning:  curl_setopt(): supplied argument is not a valid File-Handle resource in /home/4sc1CK/prog.php on line 7
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/4sc1CK/prog.php on line 10