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_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);
if ($versionIP == 4) {
@ -91,11 +91,16 @@ class ApiController
$error = true;
$result = curl_error(handle: $curl);
}
$info = curl_getinfo(handle: $curl);
$responseTime = $info['total_time'];
curl_close(handle: $curl);
return [
'error' => $error,
'data' => $result,
'header' => $httpResponse ?? ''
'responseTime' => $responseTime,
'error' => $error,
'data' => $result,
'header' => $httpResponse ?? ''
];
}