added response time
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
18112b7937
commit
5b0ba2bd09
|
@ -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 ?? ''
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue