Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download a large file (streaming) with php and curl extension
<?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);
@kurulkarvinay
Copy link

kurulkarvinay commented Jul 11, 2018

Super Helpful for me.

Thank You.

@nikolayvitaev
Copy link

nikolayvitaev commented May 23, 2019

Thank you

@kicktv
Copy link

kicktv commented May 13, 2020

is work...
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment