I am using cURL to firstly get a list of files from a remote FTP server. I then use the same Curl Handle to download that file. After the download, I then once again use the same handle to remove the file.
When I use the following code to remove the file, it does succeed:
curl_setopt($tmp["curl"], CURLOPT_QUOTE, array("DELE " . $tmp["file"]));
although I get the following in the logs:
[PHP Warning] curl_exec(): CURLOPT_FILE resource has gone away, resetting to default [l:52]
The reason is that when I first downloaded the file, I set the following option:
curl_setopt($tmp["curl"], CURLOPT_FILE, $tmp["file_handle"]);
My question is, how do I unset options that I have added? I want to remove the above option so that I can reuse the curl connection to delete the file.. or what option to I set to basically unset this option?
You unset an option by setting the value to null
, like so:
curl_setopt($tmp["curl"], CURLOPT_QUOTE, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With