mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Catch (timeout) errors on communication with hamqth
This commit is contained in:
@@ -125,7 +125,12 @@ class Callbook {
|
||||
|
||||
if (!$this->ci->session->userdata('hamqth_session_key')) {
|
||||
$hamqth_session_key = $this->ci->hamqth->session($username, $password);
|
||||
$this->ci->session->set_userdata('hamqth_session_key', $hamqth_session_key);
|
||||
if ($hamqth_session_key == false) {
|
||||
$callbook['error'] = __("Error obtaining a session key for HamQTH query");
|
||||
return $callbook;
|
||||
} else {
|
||||
$this->ci->session->set_userdata('hamqth_session_key', $hamqth_session_key);
|
||||
}
|
||||
}
|
||||
|
||||
$callbook = $this->ci->hamqth->search($callsign, $this->ci->session->userdata('hamqth_session_key'));
|
||||
|
||||
@@ -21,6 +21,10 @@ class Hamqth {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if(curl_errno($ch)) {
|
||||
log_message('error', 'Hamqth query failed: '.curl_strerror(curl_errno($ch))." (".curl_errno($ch).")");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
|
||||
Reference in New Issue
Block a user