LoTW CRL check function

This commit is contained in:
phl0
2025-11-19 14:07:58 +01:00
parent 15475a62a3
commit 6b35bd48bd
2 changed files with 23 additions and 1 deletions

View File

@@ -1257,4 +1257,26 @@ class Lotw extends CI_Controller {
endswitch;
}
function lotw_cert_status ($serial = null) {
if (($serial ?? '') != '' && is_numeric($serial)) {
$url = 'https://lotw.arrl.org/lotw/crl?serial='.$serial;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$result = curl_exec($ch);
$xml = new SimpleXMLElement($result);
switch ((string)$xml->Status) {
case 'Superceded':
return 1;
case 'Unrevoked':
return 0;
default:
log_message('error', 'Unknown LotW CRL status: '.(string)$xml->Status);
return 99;
}
}
return 99;
}
} // end class