Automated importing of LoTW users

This commit is contained in:
Peter Goodhall 2014-03-03 17:28:33 +00:00
parent 06f74f3ed7
commit 008471a19d
2 changed files with 39 additions and 1 deletions

View File

@ -4,7 +4,8 @@ class Update extends CI_Controller {
/*
Controls Updating Elements of Cloudlog
Functions:
dxcc
dxcc - imports the latest clublog cty.xml data
lotw_users - imports lotw users
*/
public function index()
@ -160,5 +161,26 @@ class Update extends CI_Controller {
echo "<table>";
}
public function lotw_users() {
// Load Database connectors
$this->load->model('lotw');
$this->lotw->empty_table("lotw_list");
$lines = file('http://www.hb9bza.net/lotw/lotw1.txt');
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
$data = array(
'Callsign' => $line,
);
$this->db->insert('lotw_list', $data);
}
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
class LOTW extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function empty_table($table) {
$this->db->empty_table($table);
}
}
?>