CURLOPT_FAILONERROR and simple_get
Just want to mention that some APIs return error codes 400 or greater. A response message is returned by the API which would be useful, (in this instance the http code was 400 and the error was an xml string), but because of the CURLOPT_FAILONERROR (which defaults to true for simpleget and can not be changed via that call), the response from the curl class is FALSE.
I figured this out pretty quickly and created a custom request:
$this->ci->curl->create($query_string);
$this->ci->curl->option('FAILONERROR', FALSE);
$request = $this->ci->curl->execute();
So that works, and it's simple. This perhaps should be noted in the README, or a second param with options could be available for simple_get.
Calvin,
That was very helpful. I too would like to be able to pass in that FAILONERROR option. I tried it with the simple_get but couldn't get it to work properly. I may have misread Phil's docs, but I thought I would have been able to pass in an array of options to a simple_get. The 'long hand' method you stated above does the trick though.
-John