Пример #1
0
 /** http://www.streetdirectory.com/sg/1-suites/1-lorong-20-geylang-398721/100869_51869.html
     * @Author: ANH DUNG Mar 04, 2015
     * @Todo: 6-Digit Postal Code Subscription
     * The latest update of the database is attached please.
        The data have been updated as at 10 Feb 2015.
     * @Link: verzview.com/verzpropertyinfo/demo2/site/importApi
     * @cron: s:39:" done in: 285  Second  <=> 4.75 Minutes";
     * s:39:" done in: 273  Second  <=> 4.55 Minutes";
     * s:48:" done in: 235  Second  <=> 3.91666666667 Minutes";
     */
 public function ConsoleImportApiUpdate()
 {
     //        Yii::app()->setting->setDbItem('rss', 0); // for run cron NewsletterCommand
     //        echo Yii::app()->setting->getItem('rss');die;
     //        phpinfo();
     //        echo "need close this line to run. Please read careful step above";die;
     $from = time();
     set_time_limit(72000);
     //        $sql = "insert into {{_api_postcode}} ( postal_code ) values ( '019191K31 MAR0043MAR036999999' ),( '019191K31 MAR0043MAR036' ) ";
     //        Yii::app()->db->createCommand($sql)->execute();die;
     $root = ROOT . '/api';
     // ApiAddress, ApiBuilding, ApiPostcode, ApiStreets, ApiWalkup
     $aInfoImport = array(array('ClassName' => 'ApiWalkup', 'FieldName' => 'walkup', 'file_name' => 'WALKUP.TXT'));
     // array name file to import
     foreach ($aInfoImport as $item) {
         $importFile = $root . "/" . strtolower($item['file_name']);
         if (file_exists($importFile)) {
             $aExists = array();
             $aNew = array();
             $aData = file($importFile, FILE_IGNORE_NEW_LINES);
             ApiPostcode::HandleImport($item['ClassName'], $item['FieldName'], $aData, $aExists, $aNew);
             ApiPostcode::InsertNewRecord($item['ClassName'], $item['FieldName'], $aNew);
         }
     }
     //        ApiPostcode::HandleUpdateLonLatTableBuilding(); // only run from cron job
     $to = time();
     $second = $to - $from;
     echo ' done in: ' . $second . '  Second  <=> ' . $second / 60 . ' Minutes';
     die;
 }
Пример #2
0
 /**
  * @Author: ANH DUNG Oct 27, 2014
  * @Todo: get property_house_blk_no
  * @Param: $postal_code
  */
 public static function getStreetName($postal_code)
 {
     $property_street_name = '';
     if (trim($postal_code) != '') {
         $street_key = ApiPostcode::getValueKeyByPostalCode($postal_code, 'street_key');
         $property_street_name = ApiStreets::getValueKeyByStreetKey($street_key, 'street_name');
     }
     return $property_street_name;
 }
Пример #3
0
     // Execute the curl session
     $output = curl_exec($ch);
     // Close the curl session
     curl_close($ch);
     // Return the output as a variable
     return $output;
 }
 public function actionLoaddata($data)
 {
     $this->layout = false;
     /*        ini_set('memory_limit', '500M');
     $criteria = new CDbCriteria;
     $criteria->condition = $condition;
     $url    =  Yii::app()->createAbsoluteUrl('/upload/datamap.txt');
     $output = $this->curl_get_contents($url);
     die($output);*/
     if ($data) {
         $data = json_decode($data, true);
         $dataJson = array();