I have code in which I try to use the curl context to make requests and receive requests. After each send request, the request for the request is interrupted with this PHP warning:
curl_exec (): resource CURLOPT_INFILE is gone, resetting to default settings
I could use the PHP shutup operator, but I would prefer to properly reset the curl context. Does anyone know how to do this? I could also use different curl contexts, but I would prefer to reuse the connection as the application sends a lot of requests. I could keep the file descriptor open, but it seems like a hacker solution, especially since it is all included in the functions, so I can call doPut, doGet, etc.
$curlContext = curl_init(); $fh = fopen('someFile.txt', 'rw'); curl_setopt($curlContext, CURLOPT_URL, $someUrl); curl_setopt($curlContext, CURLOPT_PUT, TRUE); curl_setopt($curlContext, CURLOPT_INFILE, $fh); curl_setopt($curlContext, CURLOPT_INFILESIZE, $size); $curl_response1 = curl_exec($curlContext); fclose($fh); curl_setopt($curlContext, CURLOPT_PUT, FALSE); curl_setopt($curlContext, CURLOPT_HTTPGET, TRUE); curl_setopt($curlContext, CURLOPT_URL, $someOtherUrl); $curl_response1 = curl_exec($curlContext);
Thanks.
source share