Closed leo-combes closed 3 years ago
Sorry for the late response. We cannot reproduce this issue. Timeout happens after the default value of 10sec.
Running the default example:
Zabbix API Example
Connect to API, check certificate/hostname and get number of hosts
=====================================================
==== Exception ===
Errorcode: 0
ErrorMessage: Request failed with HTTP-Code:0, sslVerifyResult:0. Connection timed out after 10015 milliseconds
And when setting timeout to 3 seconds:
$zbx->login($zabUrl, $zabUser, $zabPassword, ['connectTimeout' => 3]);
Output as expected
Zabbix API Example
Connect to API, check certificate/hostname and get number of hosts
=====================================================
==== Exception ===
Errorcode: 0
ErrorMessage: Request failed with HTTP-Code:0, sslVerifyResult:0. Connection timed out after 3014 milliseconds
Btw.: This code has been part of the first commit:
if ( $httpCode == 0 || $httpCode >= 400) {
throw new Exception("Request failed with HTTP-Code:$httpCode, sslVerifyResult:$sslVerifyResult. $sslErrorMsg", $httpCode);
}
Let us know wether this issue still exists.
Hi! I'm testing your API and is impressive, good work. It seems that if you call login with incorrect, invalid or down host server, it not trigger any exception. Only error is visible in debug messages, but no error catched. Example with non existent server: $zbx->login("http://10.1.1.56/zabbix", "testuser", "test123", $options); Debug messages are:
same behavior with an invalid host, error is not triggered: $zbx->login("xxxxxxx", "testuser", "test123", $options);