added response time

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-22 15:32:59 +01:00
parent 18112b7937
commit 5b0ba2bd09
1 changed files with 9 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class ApiController
} }
curl_setopt(handle: $curl, option: CURLOPT_RETURNTRANSFER, value: 1); curl_setopt(handle: $curl, option: CURLOPT_RETURNTRANSFER, value: 1);
curl_setopt(handle: $curl, option: CURLOPT_TIMEOUT_MS, value: 3000); curl_setopt(handle: $curl, option: CURLOPT_TIMEOUT_MS, value: 19999);
curl_setopt(handle: $curl, option: CURLOPT_HTTP_VERSION, value: CURL_HTTP_VERSION_2TLS); curl_setopt(handle: $curl, option: CURLOPT_HTTP_VERSION, value: CURL_HTTP_VERSION_2TLS);
if ($versionIP == 4) { if ($versionIP == 4) {
@ -91,8 +91,13 @@ class ApiController
$error = true; $error = true;
$result = curl_error(handle: $curl); $result = curl_error(handle: $curl);
} }
$info = curl_getinfo(handle: $curl);
$responseTime = $info['total_time'];
curl_close(handle: $curl); curl_close(handle: $curl);
return [ return [
'responseTime' => $responseTime,
'error' => $error, 'error' => $error,
'data' => $result, 'data' => $result,
'header' => $httpResponse ?? '' 'header' => $httpResponse ?? ''