You are not logged in.

#1 2016-01-10 16:42:48

tho068
Member
Registered: 2016-01-10
Posts: 8

Slow CURL post request

Hello

Here is the link to the full source code: http://git.tholden.no/fason-ans/auto-re … -pmpro.php

When i execute the call to the curl function, the request takes about ten seconds to complete. The same request from POSTMAN, or probably any other
rest client takes a couple of ms.

Do anyone know what could be wrong?

Here is the specific function:

/*
* Function used to execute a curl request
*/
function execute_curl_request($headers = null, $data = null, $url, $type)
{
    $send = curl_init($url);

    curl_setopt($send, CURLOPT_CUSTOMREQUEST, $type);

    curl_setopt($send, CURLOPT_RETURNTRANSFER, true);

    if ($headers != null) {
        curl_setopt($send, CURLOPT_HTTPHEADER, $headers);
    }

    if ($data != null) {
        curl_setopt($send, CURLOPT_POSTFIELDS, json_encode($data));
    }

    // Exec the request and decode the result.
    $result = json_decode(curl_exec($send));

    curl_close($send);

    return $result;
}

It is not DNS lookup that takes all the time. I have checked that with get_info().

The only huge numbers in the get_info array is starttransfertime which is 10 seconds.

Last edited by tho068 (2016-01-10 16:48:58)

Offline

#2 2016-01-12 16:39:22

tho068
Member
Registered: 2016-01-10
Posts: 8

Re: Slow CURL post request

API problem. They are looking into it. Thanks.

Offline

Board footer

Powered by FluxBB