-
-
Save rcg4u/31c999141a4df4cee64d449d2788f52e to your computer and use it in GitHub Desktop.
Download a large file (streaming) with php and curl extension
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 = 'http://www.example.com/a-large-file.zip'; | |
$path = '/path/to/a-large-file.zip'; | |
$fp = fopen($path, 'w'); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_FILE, $fp); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
fclose($fp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment