I was refactoring my cURL class today and thought about looking at default values of cURL FLAGS.
Could anyone tell me where I might find or how could I output them?
PS: If it's possible at all.
I have been researching the same problem today and came across this (rather old) post. Since it shows up pretty much at the top of Google, I thought this is the place to conclude my research.
In short: It's not possible.
It seems like most cURL options do not even have any default values. For example, timeouts. Or the user agent. But many others do have defaults, as the PHP manual states. I could not find any list of default values - neither for PHP's cURL extension, nor for cURL in general. Only individual defaults that are mentioned within said PHP manual or within the cURL API doc. However, I doubt that every single default is mentioned within those pages.
Unfortunately, finding them out programmatically is not possible, either. The idea would be to find out all options values before setting the first one. But there is no curl_getopt()
. Not even in cURL itself. All solutions that emulate curl_getopt()
can only retrieve those options that have been set manually.
After a (very) short glance at the cURL source code (the original C lib) I also suspect that sometimes there are no real defaults, but if an option is not set, some logic goes into figuring out which value to use. In that case, default values would not even be well-defined.
Lastly, chances are that PHP's cURL extension employs some different defaults than cURL itself.
So unless some cURL developer sheds some light on this - or at least someone who has the time and skill to really dive into the code - we are pretty much stuck on this.