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

This comment has been minimized.

Copy link

commented Jul 11, 2018

Super Helpful for me.

Thank You.

@nikolayvitaev

This comment has been minimized.

Copy link

commented May 23, 2019

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.