Skip to content

CURLOPT_FAILONERROR and simple_get #6

@calvinfroedge

Description

@calvinfroedge

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions