php - Downloading large files with cURL? -
i'm new curl , searched script download remote files server using curl. found this:
<?php $url = 'http://www.example.com/a-large-file.zip'; $path = $_server['document_root'] . '/downloads/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); ?> this script here , works, part. although in article, it's stated code doesn't have problem of php memory limit, it downloads 8 mb of file, no matter size of file.
does have idea limitation coming , how overcome it?
could problem related timeout? try add
curl_setopt($ch, curlopt_timeout, 300); // 300 number of seconds
Comments
Post a Comment