Fixes QRZ API session time outs

pull/106/merge
Peter Goodhall 2012-11-14 01:16:17 +00:00
rodzic 054eb0598e
commit 0f6ba82f92
3 zmienionych plików z 13 dodań i 21 usunięć

Wyświetl plik

@ -16,7 +16,7 @@ $config['app_name'] = "Cloudlog";
$config['app_version'] = "0.1";
$config['directory'] = "logbook";
$config['callbook'] = "callbytxt"; // Options are qrz or callbytxt
$config['callbook'] = "qrz"; // Options are qrz or callbytxt
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -5,24 +5,13 @@ class Welcome extends CI_Controller {
public function index()
{
//$this->load->view('welcome_message');
$this->load->library('qrz');
$qrz_session_key = $this->qrz->set_session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
// URL to the XML Source
$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?username='.$username.';password='.$password.';agent=cloudlog';
// CURL Functions
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_feed_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);
// Create XML object
$xml = simplexml_load_string($xml);
print_r($xml);
echo $this->session->userdata('qrz_session_key');
$data['callsign'] = $this->qrz->search("m3php", $this->session->userdata('qrz_session_key'));
}
}

Wyświetl plik

@ -30,6 +30,8 @@ class Qrz {
// Set Session Key session.
public function set_session($username, $password) {
$ci = & get_instance();
// URL to the XML Source
$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?username='.$username.';password='.$password.';agent=cloudlog';
@ -45,8 +47,8 @@ class Qrz {
$xml = simplexml_load_string($xml);
$key = (string) $xml->Session->Key;
$this->session->set_userdata('qrz_session_key', $key);
$ci->session->set_userdata('qrz_session_key', $key);
return true;
}
@ -77,7 +79,8 @@ class Qrz {
$data['lat'] = (string) $xml->Callsign->lat;
$data['long'] = (string) $xml->Callsign->lon;
$data['iota'] = (string) $xml->Callsign->iota;
return $data;
}
}