Created
September 29, 2022 21:49
-
-
Save OkoyaUsman/4e9a9cce3f0e5a254fbddbc9dbbc8e70 to your computer and use it in GitHub Desktop.
Stream/Download video files from remote location to users without memory overload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = ""; | |
$useragent = ""; | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_VERBOSE, true); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 222222); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
curl_setopt($ch, CURLOPT_NOBODY, false); | |
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header){ | |
header($header); | |
return strlen($header); | |
}); | |
curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($curl, $body){ | |
echo $body; | |
return strlen($body); | |
}); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment