Welcome Guest, Not a member yet? Register   Sign In
CURLRequest extends
#1

Hi 
CURLRequest class, function sendRequest does not return curl_getinfo($ch). And he should. The question is whether it is possible to extend the CURLRequest class. If so, how?
Reply
#2

What CI version? I think the newest version has some behavior changes with cURL.
Reply
#3

Ci4

I overwrote $client = \Config\Services::mycurlrequest();
and

    protected function sendRequest(array $curlOptions = []): string
    {
        $ch = curl_init();

        curl_setopt_array($ch, $curlOptions);

        // Send the request and wait for a response.
        $output = curl_exec($ch);

        if ($output === false) {
            throw HTTPException::forCurlError((string) curl_errno($ch), curl_error($ch));
        }

        curl_close($ch);
        $this->requestInfo = curl_getinfo($ch);
        return $output;
    }

And it works - but it's probably not the best idea
Reply




Theme © iAndrew 2016 - Forum software by © MyBB