0

It is posible to download a file using CURLOPT_FILE with Curl (Philip Sturgeon) library?

Right now I'm using, it works but I want to do it with Curl library:

set_time_limit(0);
ini_set('display_errors',true);//Just in case we get some errors, let us know....

$fp = fopen ('/Users/tony/labs/store/'. 'a.mp4', 'w+');//This is the file where we save the information
$ch = curl_init($previewUrl);//Here is the file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
fclose($fp);

I want something like this:

$file = fopen($to, 'w');
$this->curl->create($url);
$this->curl->option('file', $file);
$this->curl->execute();
fclose($file);

1 Answer 1

1

I think using a Library that wraps curl which by itself is already extremely simple is just overkill.

If it does not support it the library is only a single.php file, you could easily add that one line of code in there and it would support it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.