Set curl-Useragent for qrz-requests as recommended

This commit is contained in:
int2001
2024-10-04 04:49:11 +00:00
parent 43d85ce0dd
commit 8a7e073621
3 changed files with 10 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ class Qrz {
// Return session key
public function session($username, $password) {
// URL to the XML Source
$ci = & get_instance();
$xml_feed_url = 'https://xmldata.qrz.com/xml/current/?username='.$username.';password='.urlencode($password).';agent=wavelog';
// CURL Functions
@@ -18,7 +19,8 @@ class Qrz {
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$ci->optionslib->get_option('version'));
$xml = curl_exec($ch);
curl_close($ch);
@@ -43,7 +45,8 @@ class Qrz {
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$ci->optionslib->get_option('version'));
$xml = curl_exec($ch);
curl_close($ch);
@@ -60,6 +63,7 @@ class Qrz {
public function search($callsign, $key, $use_fullname = false, $reduced = false) {
$data = null;
$ci = & get_instance();
try {
// URL to the XML Source
$xml_feed_url = 'https://xmldata.qrz.com/xml/current/?s=' . $key . ';callsign=' . $callsign . '';
@@ -71,6 +75,7 @@ class Qrz {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$ci->optionslib->get_option('version'));
$xml = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);