Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURLOPT_FAILONERROR and simple_get #6

Open
calvinfroedge opened this issue Aug 18, 2011 · 1 comment
Open

CURLOPT_FAILONERROR and simple_get #6

calvinfroedge opened this issue Aug 18, 2011 · 1 comment

Comments

@calvinfroedge
Copy link

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.

@johnfmorton
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants