Example #1
0
 function &_loadNew()
 {
     $new_file = Countries::_readURL($this->_url);
     if (is_a($new_file, 'PEAR_Error')) {
         $this->cli->fatal(sprintf(_("Cannot read source for country data. %s"), $new_file->getMessage()));
     }
     $lines = explode("\r\n", $new_file);
     $new_data = array();
     foreach ($lines as $line) {
         if (!preg_match('/^(.*?);(\\w\\w)$/', $line, $matches)) {
             continue;
         }
         $new_data[$matches[2]] = $matches[1];
     }
     return $new_data;
 }