0
All my POST type requests for a specific URL are taking about 3 minutes to return the sponse, that is, a few seconds after I submit the form, I look at the API website and there is my data posted, but on my site the request is pending, after exact 3 minutes it is finalized returning the required data.
I believe something is holding the answer for 3 minutes as I tested the same code in local environment and worked quickly (took about 10 seconds), which may be causing this "slowness"?
public function http_request($url, $headers, $data = array())
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.binance.com/api/v3/order');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if ($data) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_ENCODING, "");
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
It is possible to restart the server?
– Reginaldo Rigo
Yes it is possible, but the POST in other Apis is faster, less than 10 seconds.
– viniciussvl
Yes. I understood that it works fast on another machine, so I suggested resetting the server.
– Reginaldo Rigo
Not on another machine, on the same server, if I send a POST to another different API, it’s pretty fast. Even so I will restart it to "ensure".
– viniciussvl
I get it. Well, in that case the possibility of solving has greatly diminished. :(
– Reginaldo Rigo
Unfortunately not solved, how can it take 3 minutes to return a reply kk? I still do not believe it
– viniciussvl
Are you sure it’s the
http_request
it takes 3 minutes? There is nothing before or after? When you do thecurl
for the same site via terminal it takes the same 3 minutes? Curl, Openssl, GZIP and PHP are updated in the latest version?– Inkeliz
Yes, they’re up to date. I can’t test from the terminal
– viniciussvl
I tested by the terminal @Inkeliz and it seems that worked very fast
– viniciussvl