when retrieving data from a URL using curl, I sometimes (in 80% of the cases) get
error 18: transfer closed with outstanding read data remaining
Part of the returned data is then missing. The weird thing is that this does never occur when the CURLOPT_RETURNTRANSFER is set to false, that is the curl_exec function doesn't return the data but displays the content directly.
What could be the problem? Can I set some of the options to avoid such behaviour?
Connection: Close
headers? If so, try using something likeConnection: Keep-Alive
andKeep-Alive: ***
where *** is a number of your choosing that makes sense (maybe 10 seconds, to be safe; most modern browsers use 300, which is 5 minutes). – Attenuator