Commits

Bi Haicheng committed 9fd751b

backup

Comments (0)

Files changed (6)

 <?php
 /**
- * fetch hospital page
+ * update mysql
  *
  * PHP version 5
  *
  *
  * @copyright  Copyright (c) 2010,Sagittarius Technology Co. Ltd.
  * @link       splayer.org
- * @package    
- * @subpackage 
+ * @package    app
+ * @subpackage app.controllers
  * @author     Bi Haicheng
- * @since      v 1.0   21 February, 2011
- * @license    MIT
+ * @since      v 1.0   23 February, 2011
+ * @license    Commercial
  **/
 
 /**
- * 
+ * Define DocBlock
  */
-include('fetch_doc.php');
+//include('fetch_doc.php');
+//include('fetch_hospital.php');
 /**
- * 读取每个目录下的静态文件
+ * 更新数据库
  *
- * getHospital class
+ * undocumented class
  *
  * @use         AppController
  * @packaged    app
  * @subpackaged app.controllers
  * @author      Bi Haicheng
  **/
-class getHospital extends fetchWebPage
+/*
+ *read a file
+ */
+class updateSql //extends fetchHospital
 {
+    public $base_dir='/home/home/work/webfile/';
+    /**
+     * read sql file and match chinese
+     *
+     * readSql method
+     *
+     * @return void
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function readSql()
+    {
+        //read hospital sql file
+        //fetch chinese hospital name
+        //fetch areaid field value numer
+        //read area sql file
+        //fetch id field number
+        //if areaid number match area number
+        //replace the name use we have fetched from 39.net
+        //return a new sql file
+    }
 
-    public $base_url='yyk.39.net';
     /**
-     * 
+     * match sqlfile areaid
+     *
+     * getAreaid method
+     *
+     * @return void
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function getAreaid()
+    {
+    }
+     /**
+      * find a line by areaid
+      *
+      * findRow method
+      *
+      * @return void
+      * @access public
+      * @author Bi Haicheng
+      **/
+     public function findRow($areaid)
+     {
+        //234,224,424 like this ids
+        $areaids=explode($areaid);
+        return ;
+     } 
+    /**
+     * get area and its hospital from director
+     *
+     * iteratorHospital method
+     *
+     * @return void
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function iteratorHospital()
+    {
+        $dir_files=array();
+        //step controller
+        try{
+        foreach(new DirectoryIterator($this->base_dir) as $file){
+            if ($file->isDir()&&!$file->isDot()) {
+                $inner_dir=$this->base_dir.$file->getFilename()."/";
+                foreach (new DirectoryIterator($inner_dir) as $inner_file)
+                {
+                    if ($inner_file->isDir()&&!$inner_file->isDot()) {
+                        //inner inner dir
+                        $inner_indir=$inner_dir.$inner_file->getFilename()."/";
+                        foreach (new DirectoryIterator($inner_indir) as $inner_infile) {
+                            if (!$inner_infile->isDot()) {
+                                $dir_files[$file->getFilename()][$inner_file->getFilename()][]=substr($inner_infile->getFilename(),0,-5);//=$inner_file->getPath().'/'.$inner_file->getFilename();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        }
+        catch(Exception $e){
+        $this->error=$e->getMessage();
+        trigger_error($this->error);
+        }
+        return $dir_files;
+    }
+    /**
+     * match hospital return area array
      *
      * undocumented function
      *
      * @access public
      * @author Bi Haicheng
      **/
-    public function matchChinese($string)
+    public function getAreaSearchDir()
     {
+        $areas=array();
+        $area_hos=$this->iteratorHospital();
+        var_dump($area_hos);
+        exit;
+        $areaid_hosname=$this->getHosAreaidFsql();
+        foreach ($area_hos as $area => $hnames) {
+          foreach ($hnames as $child_area=>$hos_names) {
+              foreach ($hos_names as $hname) {
+                  foreach ($areaid_hosname as $areaid=>$name) {
+                        if ($hname==$name) {
+                            $areas[$area][$child_area]=$hname;
+                        }
+                        else {
+                     //     echo 'Do not have this hospital .';
+                        }
+                    }
+                }
+            }
+        }
+        print_r($areas);
+        return $areas;
         /*
-        preg_match('/<a\shref=".*?">[^\x00-\xff]*<\/a>/',$string,$match);
-            preg_match('/<a\shref=".*?".*?>[u4e00-u9fa5]*.*?<\/a>/',$string,$match);
-            preg_match('/<a.*?>[\x00-\xff]*<\/a>/',$string,$match);
-            preg_match('/<a.*?>[\x00-\xff]*<\/a>/',$string,$match);
-            preg_match('/<a\shref=".*?".*?>[^u4e00-u9fa5]<\/a>/',$string,$match);
+        $new_arr=array();
+        foreach ($areas as $area =>$child_areas) {
+            foreach ($child_areas as $p=>$h) {
+                $new_arr[$area]=$p;
+            }
+        }
+           return $new_arr;
          */
-//GBK匹配中文
-/*
-            preg_match('/<a\shref=".*?".*?>[\x80-\xff]*<\/a>/',$string,$match);
- */
-        //UTF8匹配中文
-            preg_match('/<a\shref=".*?".*?>[^u4e00-u9fa5]*<\/a>/',$string,$match);
-            return $match;
     }
     /**
      * 
      * @access public
      * @author Bi Haicheng
      **/
-    public function getChinese($string)
+    public function getIdToUpdate()
     {
-            //preg_match('/[u4e00-u9fa5]+/',$string,$match);
-            //匹配中文
-            preg_match_all('/[\x80-\xff]+/',$string,$match);
-            return $match;
-    }
+        $areas=$this->getAreaSearchDir();
+        $areaid_name=$this->getAreaIdName();
+        //var_dump($areaid_name);
+        $areaids=array();
+        $i=0;
+        foreach ($areas as $areaA=>$areaBs) {
+          foreach ($areaBs as $areaB=>$hname) {
+            foreach ($areaid_name as $areaid=>$name) {
+                    if ($name==$areaA){
+                        $areaids[$i][]=$areaid;
+                    }
+            }
+            foreach ($areaid_name as $areaid=>$name) {
+                    if($name==$areaB) {
+                        $areaids[$i][]=$areaid;
+                    }
+            }
+           // print_r();
+            //
+                    $this->selectDB();
+                    $consql="update hospital set areaid =',".$areaids[$i][0].",".$areaids[$i][1].","."'"." where name_hospital='".$hname."';";
+                    echo $consql;
+                    $result=mysql_query($consql);
+                    var_dump($result);
+                    var_dump($hname);
+                    $i++;
+                }
+            }
+            //var_dump($areaids);
+            //exit;
+        }
+            //update hospital table area_id by got id
+            //$this->selectDB();
+            //$consql="update hospital set areaid =',$areaids[0],$areaids[1],' where name_hospital=$id[0]";
+            //return $areaids;
     /**
-     * 从代码中获取医院的URL
      *
-     * getUrl method
+     *
+     * undocumented function
      *
      * @return void
      * @access public
      * @author Bi Haicheng
      **/
-    public function getUrl()
+    public function uHosAreaField()
     {
 
     }
     /**
-     * 获得医院名称
+     * get Hospital and Area data from web page that alread fetched
      *
-     * 根据URL获取医院名称switch case
+     * getHosAreaFweb method
      *
-     * getHosName method
+     * @return array
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function getHosAreaFweb()
+    {
+       $web_hos_areas=$this->iteratorHospital();
+       return $web_hos_areas;
+    }
+    /**
+     * get an array of hospital and id from sql file
+     *
+     * getHosarr method
      *
      * @return void
      * @access public
      * @author Bi Haicheng
      **/
-    public function getHosName()
+    public function getHosAreaidFsql()
     {
+      $hospital_id_name=array();
+      $hosql=file_get_contents($this->base_dir.'hospital.sql');
+      //匹配areaid
+      preg_match_all('/\([0-9]+,\s\'.*?\',\s\'[\x80-\xff]+\',.*?,[0-9]+,[0-9]+,.*?/',$hosql,$id_name);
+      //匹配Id
+      //preg_match_all('/\([0-9]+,\s\'.*?\',\s\'[\x80-\xff]+\',/',$hosql,$id_name);
+      //print_r($id_name);
+      for ($i = 0; $i < count($id_name[0]); $i++) {
+            preg_match('/,[0-9]+,[0-9]+,/',$id_name[0][$i],$id);
+            preg_match('/[\x80-\xff]+/',$id_name[0][$i],$name);
+            $hospital_id_name[$i][$id[0]]=$name[0];
+      }
+      $sql_hos_areaids=$hospital_id_name;
+      //print_r($sql_hos_areaids);
+      //exit;
+      $new_hos_id_name=array();
+      foreach ($sql_hos_areaids as $id=>$name_arr) {
+          foreach ($name_arr as $hosid=>$name) {
+            $new_hos_id_name[$hosid]=$name;
+          }
+      }
+      //print_r($new_hos_id_name);
+      //$this->selectDB();
+      //$consql="select areaid from hospital where hospital_id=$id[0]";
+      return $new_hos_id_name;
     }
+
     /**
-     * 获得医院列表代码
+     * get Area Id Name from area table
      *
-     * getHosLi method
+     * getAreaIdName method
      *
      * @return array
      * @access public
      * @author Bi Haicheng
      **/
-    public function getHosLi($area,$reg)
+    public function getAreaIdName()
     {
-        $area_hos_url=array();
-        $area_hos_code=$this->getHosLiCode($area,$reg);
-        for ($i = 0; $i < count($area_hos_code); $i++) {
-                /*
-                preg_match_all('/<a\shref=".*?".*?>[\x80-\xff]+<\/a>/',$area_hos_code[$i],$area_hos_url[$i]);
-                preg_match_all('/<a.*?>.*?<\/a>/',$area_hos_code[$i][0],$area_hos_url);
-                 */
-            preg_match_all('/<span\sclass="yy_title">.*?<a.*?>[\x80-\xff]+<\/a>.*?<span.*?>.*?<\/span>.*?<\/span>/s',$area_hos_code[$i][0],$area_hos_url[$i]);
-            }
-        //减维
-        $new_arr=array();
-        for ($i = 0; $i < count($area_hos_url); $i++) {
-            for ($j = 0; $j < count($area_hos_url[$i]); $j++) {
-                for ($p = 0; $p < count($area_hos_url[$i][$j]); $p++) {
-                    $new_arr[$i][$p]=$area_hos_url[$i][$j][$p];
-                }
-            }
-        }
-       // var_dump($new_arr);
-       // exit;
-        return $new_arr;
+      $hospital_id_name=array();
+      $hosql=file_get_contents($this->base_dir.'area.sql');
+      //匹配areaid
+      preg_match_all('/\([0-9]+,\s[0-9]+,\s\'[\x80-\xff]+\',/',$hosql,$id_name);
+      //匹配Id
+      //preg_match_all('/\([0-9]+,\s\'.*?\',\s\'[\x80-\xff]+\',/',$hosql,$id_name);
+      //print_r($id_name);
+      for ($i = 0; $i < count($id_name[0]); $i++) {
+            preg_match('/[0-9]+,\s[0-9]+/',$id_name[0][$i],$id);
+            $idtwo=explode(',',$id[0]);
+            //$area_id=$idtwo[0];
+            preg_match('/[\x80-\xff]+/',$id_name[0][$i],$name);
+            $hospital_id_name[$i][$idtwo[0]]=$name[0];
+      }
+      $sql_hos_areaids=$hospital_id_name;
+      //print_r($sql_hos_areaids);
+      //exit;
+      $new_hos_id_name=array();
+      foreach ($sql_hos_areaids as $id=>$name_arr) {
+          foreach ($name_arr as $hosid=>$name) {
+            $new_hos_id_name[$hosid]=$name;
+          }
+      }
+      //print_r($new_hos_id_name);
+      //$this->selectDB();
+      //$consql="select areaid from hospital where hospital_id=$id[0]";
+      return $new_hos_id_name;
     }
     /**
      * 
      * @access public
      * @author Bi Haicheng
      **/
-    public function getHosLiUrl($area,$reg)
+    public function selectDB()
     {
-        $area_urls=array();
-        $area_hos_name=array();
-        $area_a_arr=$this->getHosLi($area,$reg);
-        for ($i = 0; $i < count($area_a_arr); $i++) {
-           for ($j = 0; $j < count($area_a_arr[$i]); $j++) {
-           preg_match(
-               '/[\x80-\xff]+/',
-              $area_a_arr[$i][$j],
-              $area_hos_name[$i][]);
-           }
+        $pcm=$this->connMysql();
+        if(mysql_ping($pcm)){
+            $db=mysql_select_db("9939_com_dzjb");
         }
-        /*
-        echo '<pre>';
-        print_r($area_hos_name);
-        echo '</pre>';
-        exit;
-         */
-         //减维
-        $new_arr=array();
-        for ($i = 0; $i < count($area_hos_name); $i++) {
-            for ($j = 0; $j < count($area_hos_name[$i]); $j++) {
-                $new_arr[$i][$j]=$area_hos_name[$i][$j][0];
+        else{
+            echo 'Can not connect mysql.';
+        }
+        return $db;
+    }
+    /**
+     * 
+     *
+     * updateS method
+     *
+     * @return void
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function updateHosArea()
+    {
+        $this->selectDB();
+        foreach ($this->getHosAreaFweb as $webhos =>$area) {
+            foreach ($this->getHosAreaidFsql as $sqlhos => $areaid) {
+                if ($webhos==$sqlhos) {
+                    $areas=explode($area);
+                    $areaids=explode($areaid);
+                  //  $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
+                  //  mysql_real_escape_string($firstname),
+                  //  mysql_real_escape_string($lastname));
+                    $sql_area0="update 9939_area set name=$area[0] where id=$areaids[0]";
+                    $sql_area1="update 9939_area set name=$area[1] where id=$areaids[1]";
+                    $result0 = mysql_query($sql_area0);
+                    $result1 = mysql_query($sql_area1);
+                if (!$result0&&!$resulat1) {
+                     $message  = 'Invalid query: ' . mysql_error() . "\n";
+                     $message .= 'Whole query: ' . $sql_area0."\r\n".$sql_area1;
+                     die($message);
+                }
+                mysql_free_result($result0);
+                mysql_free_result($result1);
+                }
             }
         }
-        for ($i = 0; $i < count($area_a_arr); $i++) {
-           for ($j = 0; $j < count($area_a_arr[$i]); $j++) {
-           preg_match(
-              '/http:\/\/.*?\.html/',
-              $area_a_arr[$i][$j],
-              $area_urls[$new_arr[$i][$j]]);
-           }
-        }
-        /*
-        var_dump($area_a_arr);
-        echo '<pre>';
-        print_r($area_urls);
-        echo '</pre>';
-        exit;
-         */
-       //减维
-        $new_arr=array();
-        foreach ($area_urls as $name =>$urlarr) {
-            for ($i = 0; $i < count($urlarr); $i++) {
-                $new_arr[$name]=$urlarr[$i];
-                //$new_arr[/*mb_convert_encoding(*/$name /*,"UTF-8")*/]=$urlarr[$i];
-            }
-        }
-        //医院名称和医院的URL
-        //return $area_urls;
-        return $new_arr;
     }
     /**
-     * 遍历文件夹中的每个文件得到相关的文件信息
+     * connect to mysql db
+     *
+     * connMysql method
+     *
+     * @return resource
+     * @access public
+     * @author Bi Haicheng
+     **/
+    public function connMysql()
+    {
+        $pcm=mysql_connect(
+        //'211.167.92.197',
+        //'9939_com_dzjb',
+            //"dzjb!(&20101008new$%^"
+          '192.168.1.199',
+          '9939',
+          '9939pwd'
+            ) or die($php_errormsg);
+        return $pcm;
+    }
+    /**
+     *
      *
      * undocumented function
      *
      * @access public
      * @author Bi Haicheng
      **/
-    public function iteratorDir()
+    public function showdbs()
     {
-        $dir_files=array();
-        //step controller
-        foreach(new DirectoryIterator($this->base_dir) as $file){
-            //print $file->getPathname()."\n";
-            if ($file->isDir()&&!$file->isDot()) {
-                //文件夹名称
-                //内层目录
-                //返回数组,作为一个单独的函数,也可以。后面这样
-                $inner_dir=$this->base_dir.$file->getFilename()."/";
-                foreach (new DirectoryIterator($inner_dir) as $inner_file)
-                {
-                    if (!$inner_file->isDot()) {
-                        $dir_files[$file->getFilename()][substr($inner_file->getFilename(),0,-5)]=$inner_file->getPath().'/'.$inner_file->getFilename();
-                    }
-                }
+        /*
+        if(mysql_ping($pcm)){
+        $rdb=mysql_select_db("9939_com_dzjb");
+        $tables=mysql_list_tables('9939_com_dzjb');
+        $num_rows = mysql_num_rows($tables);
+        for ($j = 0; $j < $num_rows; $j++) {
+              echo "Table:", mysql_tablename($tables, $j), "\n";
             }
         }
-        return $dir_files;
-    }
-    /**
-     * 得到文件夹从文件名称
-     *
-     * 用此名称创建子目录
-     *
-     * undocumented function
-     *
-     * @return void
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public  function getFileNames($file)
-    {
-        stat($file);
-    }
-    /**
-     * 创建子目录和生成相应文件
-     *
-     * undocumented function
-     *
-     * @return void
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public function createInnerDirAndPage()
-    {
-        //read dir get one page
-        //get hos list code
-        //
-    }
-    /**
-     * 获得某一城市医院列表代码
-     *
-     * undocumented function
-     *
-     * @return void
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public function getHosLiCode($area,$reg)
-    {
-        //$this->iteratorDir();
-        $code_arr=array();
-        $pagecodes=$this->getPageCode($area,$reg);
-        //var_dump($pagecodes[2]);
-        for ($i = 0; $i < count($pagecodes); $i++) {
-            preg_match('/<div\sclass="yy_tabcontent2">.*?<ul.*?>.*?<\/ul>.*?<div\sclass="page">.*?<\/div>.*?<\/div>/s',$pagecodes[$i],$code_arr[$i]);
-        }
-        return $code_arr;
-    }
-    /**
-     * 扑获分页的URL用于得到医院类表代码
-     *
-     * getPagiUrl method
-     *
-     * @return array
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public function getPagiUrl($firstpage)
-    {
-/*
-         <div class="page">
-         <a href="/area-hp1-0-0-1-1-2.shtml" target="_self">2</a> 
-         <a href="/area-hp1-0-0-1-1-3.shtml" target="_self">3</a> 
-         <a\shref=".*?".*?>[1-9]+<\/a>
-*/
-      $pagiurls=array();
-      preg_match('/<div\sclass="page".*?>.*?<\/div>/s',$firstpage,$pagicode);
-   //   var_dump($pagicode[0]);
-       preg_match_all('/<a\shref=".*?".*?>[0-9]+<\/a>/',$pagicode[0],$pagiurl);
-   //   print_r($pagiurl);
-       for ($i = 0; $i < count($pagiurl); $i++) {
-           for ($j = 0; $j < count($pagiurl[$i]); $j++) {
-           preg_match(
-              '/area-[a-zA-Z0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\.shtml/',
-              $pagiurl[$i][$j],
-              $pagiurls[$j]);
-         }
-       }
-    //   print_r($pagiurls);
-       $pagiurl_arr=array();
-       for ($n = 0; $n < count($pagiurls); $n++) {
-        $pagiurl_arr[$n]=$pagiurls[$n][0];
-    }
-       return $pagiurl_arr;
+         */
     }
     /**
      * 
      * @access public
      * @author Bi Haicheng
      **/
-    public function getPagiArea($firstpage)
+    public function listTables()
     {
-       preg_match('/<div\sclass="page".*?>.*?<\/div>/s',$firstpage,$pagicode);
-       preg_match_all('/<a\shref=".*?".*?>[0-9]+<\/a>/',$pagicode[0],$pagiurl);
-       for ($i = 0; $i < count($pagiurl); $i++) {
-           for ($j = 0; $j < count($pagiurl[$i]); $j++) {
-           preg_match(
-              '/area-[a-zA-Z0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*\.shtml/',
-              $pagiurl[$i][$j],
-              $pagiurls);
-         }
-       }
-       return ;
+        /*
+        $num_rows = mysql_num_rows($tables);
+        for ($j = 0; $j < $num_rows; $j++) {
+              echo "Table:", mysql_tablename($tables, $j), "\n";
+            }
+         */
     }
     /**
-     * 存储医院详细页面文件
+     * 
      *
      * undocumented function
      *
      * @access public
      * @author Bi Haicheng
      **/
-    public function storeHosPage($area,$reg)
+    public function listDB($pcm)
     {
-        $hos_name_url=$this->getHosLiUrl($area,$reg);
-        foreach ($hos_name_url as $name=>$url) {
-           //分割URL,获取页面
-           $path=substr($url,17);
-           //在相应目录生成静态文件
-           //echo mb_check_encoding($name,'UTF-8');
-           //echo mb_convert_encoding($name,'UTF-8','GBK');
-           //exit;
-           //var_dump($path);
-           //exit;
-           if (!file_exists($this->base_dir.$area.'/'.$reg.'/'.mb_convert_encoding($name,'UTF-8','GBK').'.html')) {
-               //echo $this->base_dir.$area.'/'.$reg.'/'.mb_convert_encoding($name,'UTF-8','GBK').'.html';
-                echo mb_convert_encoding($name,'UTF-8','GBK').'完成'."\n\r";
-                $this->createPageByUrl($this->base_url,$path,$area.'/'.$reg.'/',mb_convert_encoding($name,'UTF-8','GBK').'.html');
-                //recorde the complete hospital page
-                $this->logWhichCom(mb_convert_encoding($name,'UTF-8','GBK'));
-                sleep(2);
-                echo '每生成一个页面延时2秒'."\n\r";
-           }else{
-                echo '文件已存在,生成下一个页面'."\n\r";
-           }
+        if(mysql_ping($pcm)){
+            $rdbs=mysql_list_dbs($pcm);
+            $i=0;
+            while($db=mysql_fetch_object($rdbs)){
+                $dbs=$db->Database;echo $dbs;echo "\r\n";
+                $i++;
+            }
         }
     }
     /**
-     * record which file writed
      *
-     * logWhichCom
-     * @params $comfile
+     * undocumented function
+     *
      * @return void
      * @access public
      * @author Bi Haicheng
      **/
-    public function logWhichCom($comfile)
+    public function queryS()
     {
-        $file_path=$this->base_dir;
-        //put the fetching completed file into logfile
-        file_put_contents($file_path.'/fetchingWebPage.log',$comfile,FILE_APPEND|LOCK_EX);
-        file_put_contents($file_path.'/fetchingWebPage.log',"\r\n",FILE_APPEND|LOCK_EX);
+        $firstname = 'fred';
+        $lastname  = 'fox';
+        $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
+        mysql_real_escape_string($firstname),
+        mysql_real_escape_string($lastname));
+        $result = mysql_query($query);
+        if (!$result) {
+            $message  = 'Invalid query: ' . mysql_error() . "\n";
+            $message .= 'Whole query: ' . $query;
+            die($message);
+        }
+        while ($row = mysql_fetch_assoc($result)) {
+             echo $row['firstname'];
+             echo $row['lastname'];
+             echo $row['address'];
+             echo $row['age'];
+        }
+        mysql_free_result($result);
     }
-    /**
-     * restart fetching web page
-     * return the last fetching complete file
-     *
-     * reStart method
-     *
-     * @return array
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public function reStart()
-    {
-        //read log file   
-        //from the last to first
-    }
-    /**
-     * 得到区域列表页的所有页面,包括分页
-     *
-     * getPageCode method
-     *
-     * @param  
-     * @return array
-     * @access public
-     * @author Bi Haicheng
-     **/
-    public function getPageCode($area,$reg)
-    {
-        //读取目录文件,用文件目录名字生成子目录,
-        //将新生成的子文件放进入子目录
-        $page_code=array();
-    //    var_dump($this->iteratorDir());
-   //     foreach($this->iteratorDir() as $reg_files){
-        $areareg= $this->iteratorDir();
-        $fn=$areareg[$area][$reg];
-           $page_code[0]=file_get_contents($fn);
-
-           //用从当前页面读取的页面作为起点
-           $other_url=$this->getPagiUrl($page_code[0]);
-          // var_dump($other_url);
-          // exit;
-     //   for ($i = 0; $i < count($other_url); $i++) {
-             for ($p = 1; $p <= count($other_url); $p++) {
-             //第一页的Code...N页。代码
-             $page_code[$p]=$this->url_get_contents($this->base_url,'/'.$other_url[$p-1]);
-             //生成还是不生成目录呢?
-             //Todo 如果已经本地已经存在,就读取本地
-    //    }
-        }
-      //  }
-        return $page_code;
-        //当前页面
-        //下一页面
-        //扑获分页的页面URL
-        //
-    }
-} // END 读取静态文件
-$hos=new getHospital();
-//print_r($hos->matchChinese('<a href="http://yyk.39.net/sh/zonghe/4ea31.html">上海交通大学医学院附属仁济医院</a>'));
-//print_r($hos->getChinese('<a href="http://yyk.39.net/sh/zonghe/4ea31.html">ss上海交sss通大学医学院附属仁济医院</a>'));
-//print_r($hos->getChinese('<a href="http://yyk.39.net/sh/zonghe/4ea31.html">我是</a>'));
-//得到区域所有页面代码没问题
-//$codes=$hos->getPageCode('上海','黄埔');
-//print_r($codes[2]);
-//$lc=$hos->getHosLiCode('上海','黄埔');
-//print_r($lc);
+} // END  update sql class
+$sql=new updateSql();
+//$areas=$sql->getIdToUpdate();
+print_r($sql->getAreaSearchDir());
+//print_r($areas);
+//$provice=$sql->iteratorHospital();
+//    print_r($provice);
+//$est=array();
 /*
-echo '<pre>';
-print_r($hos->getHosLiUrl('上海','黄埔'));
-echo count($hos->getHosLiUrl('上海','黄埔'));
-echo '</pre>';
- */
-//print_r($hos->getHosLi('上海','黄埔'));
-//最想知道的是生成了多少个页面
-foreach ($hos->iteratorDir() as $area=>$reg) {
-    foreach ($reg as $regname =>$regurl) {
-       // echo $area;echo '=>';echo $regname;
-        $hos->storeHosPage($area,$regname);
-        echo $area.$regname.'地区完成'."\n\r";
-    $this->logWhichCom($area);
-    $this->logWhichCom('-'.$regname);
-       //每次循环延迟2秒
-        sleep(2);
-        echo '延时2秒,进行下一地区'."\n\r";
-    }
+$est['b']['h']=3;
+//print_r($est);
+//exit;
+foreach ($est as $key => $value) {
+    print_r($value);
+    exit;
+    var_dump($value);
 }
-//$hos->storeHosPage('陕西','咸阳');
-//echo '<pre>';
-//print_r($hos->iteratorDir());
-//echo '</pre>';
+*/
+//$sql->getHosAreaidFsql();
+//$sql->getAreaIdName();
 ?>

fetch_hospital.php

  * @license    MIT
  **/
 
-include('fetch_doc.php');
+include('fetch_webpage.php');
 /**
  * 读取每个目录下的静态文件
  *
  * @subpackaged app.controllers
  * @author      Bi Haicheng
  **/
-class fetchHospital extends fetchWebPage
+class fetchHospital extends fetchWebpage
 {
 
     public $base_url='yyk.39.net';
        }
        $pagiurl_arr=array();
        for ($n = 0; $n < count($pagiurls); $n++) {
-        $pagiurl_arr[$n]=$pagiurls[$n][0];
+       $pagiurl_arr[$n]=$pagiurls[$n][0];
     }
        return $pagiurl_arr;
     }
         }
            echo $hospital_num."\r\n";
            echo $excute_count."\r\n";
-           if ($hospital_num!=$excute_num) {
+       /*    if ($hospital_num!=$excute_num) {
                $this->storeHosPage($area,$reg);
            }else {
                echo '此地区所有医院全部生成。';
                return true;
            }
+        */
  
     }
     /**
         }
         return $page_code;
     }
-} // END
+/**
+ * excute fetch web page
+ *
+ * main method
+ *
+ * @return void
+ * @access public
+ * @author Bi Haicheng
+ **/
+public function main ()
+{
 $hos=new fetchHospital();
 foreach ($hos->iteratorDir() as $area=>$reg) {
     foreach ($reg as $regname =>$regurl) {
        }
     }
 }
+//$this->main();
+}
+} // END
+$hos=new fetchHospital();
+//while(1){
 //$hos->storeHosPage('陕西省','咸阳');
-//$fwp=new fetchWebPage();
-//$fwp->getRegional('yyk.39.net','/area-all-0-0-1-0-1.shtml');
+//$hos->getRegional('yyk.39.net','/area-all-0-0-1-0-1.shtml');
+$hos->main();
+//}
 ?>

fetch_webpage.php

+<?php
+/**
+ * 抓取网页
+ *
+ * fetchWebPage class
+ *
+ * @use         
+ * @packaged    app
+ * @subpackaged app.controllers
+ * @author      Bi Haicheng
+ **/
+class fetchWebpage
+{
+
+    public $base_dir="/home/home/work/39webfile/";
+
+    public $base_host="";
+        /**
+         * 得到WEB文件内容
+         *
+         * url_get_contents method
+         *
+         * @return string
+         * @access public
+         * @author Li Yunxing
+         **/
+        public function  url_get_contents($host, $path) {
+            $requestHead =
+            "GET {$path} HTTP/1.1\r\n".
+            "Host: {$host}\r\n".
+            "User-Agent: Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13\r\n".
+            "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n".
+            "Accept-Language: zh-cn,zh;q=0.5\r\n".
+            "Accept-Encoding: gzip,deflate\r\n".
+            "Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7\r\n".
+            "Keep-Alive: 115\r\n".
+            "Connection: keep-alive\r\n\r\n";
+            $sockfd = fsockopen($host, 80, $errno, $errstr,30);
+            if (!$sockfd) {
+                echo "($errstr)";
+            }
+                stream_set_blocking($sockfd,1);
+                stream_set_timeout($sockfd,30);
+                $writeSize = fwrite($sockfd, $requestHead);
+                if($writeSize != strlen($requestHead)) {
+                        die("write error");
+                }
+                $chunked = false;
+                for(;;) {
+                        $line=fgets($sockfd,200);
+                        if(strpos($line, "Transfer") === 0) {
+                                $chunked = true;
+                                break;
+                        }
+                        if(strpos($line, "Content-Length") === 0) {
+                                $n = sscanf ($line, "Content-Length:%d", $length);
+                                $total_size = $length;
+                        }
+                        if($line == "\r\n") {
+                                break;
+                        }
+                }
+
+                $bodyContent = '';
+
+                if ($chunked) {
+                        $timeout_count=0;
+                        for(;;) {
+                                $content=fgets($sockfd,200);
+                                $length_str = fgets($sockfd, 200);
+                                sscanf($length_str, "%x\r\n", $length);
+                                if($length == 0){
+                                        break;
+                                }
+
+                                if (empty($content)) {
+                                        $timeout_count ++;
+                                }
+                                if ($timeout_count == 3) {
+                                        break;
+                                }
+                                $bodyContent .= fread($sockfd, $length);
+                        }
+                }
+                elseif(empty($total_size)) {
+                        $timeout_count=0;
+                        while(!feof($sockfd)) {
+                                $content = fgets($sockfd, 2048);
+                                if (empty($content)) {
+                                        $timeout_count ++;
+                                }
+                                if ($timeout_count == 3) {
+                                        break;
+                                }
+
+                                $bodyContent.=$content;
+                        }
+                }
+                else {
+                        while($total_size !=0) {
+                                $content = fgets($sockfd, 2048);
+                                $total_size -= strlen($content);
+                                $bodyContent .=$content;
+                        }
+                }
+                $body = substr($bodyContent, 10);
+                fclose($sockfd);
+                return gzinflate($body);
+        }
+/**
+ * 生成相应省市目录
+ *
+ * createDir method
+ *
+ * @return string
+ * @access public
+ * @author Bi Haicheng
+ **/
+public function createDir($dir)
+{
+    if(!file_exists($dir)){
+    mkdir($dir,0777) or die($php_errormsg);
+    }
+    return $dir;
+}
+/**
+ * 根据URL生成页面
+ *
+ * createPageByUrl method
+ * @param $host  url without http://
+ * @param $path  /sdf
+ * @param $dir  director name
+ * @param $file file name
+ * @return void
+ * @access public
+ * @author Bi Haicheng
+ **/
+public function createPageByUrl($host,$path,$dir,$file)
+{
+    $page_content=$this->url_get_contents($host,$path);
+    $this->createPage($host,$path,$dir,$file,$page_content);
+}
+/**
+ * 生成页面
+ *
+ * createPage method
+ *
+ * @return void
+ * @access public
+ * @author Bi Haicheng
+ **/
+public function createPage($host,$path,$dir,$file,$page_content)
+{
+    $tf=tempnam('/tmp','data-');
+    $temp_fh=fopen($tf,'w') or die($php_errormsg);
+    file_put_contents($tf,$page_content);
+    $file_path=$this->base_dir;
+    $file_content=file_get_contents($tf);
+    $cf=$file_path.$dir.$file;
+    $this->createDir($file_path.$dir);
+    $fh=fopen($cf,'w');
+    file_put_contents($cf,$file_content) or die($php_errormsg);
+    fclose($temp_fh);
+    fclose($fh);
+}
+/**
+ * 捕获leftmenu的每一个区域
+ *
+ * getRegional method
+ *
+ * @return array
+ * @access public
+ * @author Bi Haicheng
+ **/
+public function getRegional($host,$path)
+{
+    $areas=$this->getAreaArr($host,$path);
+    for ($i = 0; $i < count($areas); $i++) {
+    switch ($areas[$i]) {
+        case 'area-sh':
+            echo '上海市'."\r\n";
+            $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hp1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','黄埔区.html');
+                    break;
+                case 'area-lw1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','卢湾区.html');
+                    break;
+                case 'area-xh1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','徐汇区.html');
+                    break;
+                case 'area-cn1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','长宁区.html');
+                    break;
+                case 'area-ja2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','静安区.html');
+                    break;
+                case 'area-pt1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','普陀区.html');
+                    break;
+                case 'area-zb1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','闸北区.html');
+                    break;
+                case 'area-hk1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','虹口区.html');
+                    break;
+                case 'area-yp1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','杨浦区.html');
+                    break;
+                case 'area-mx2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','闵行区.html');
+                    break;
+                case 'area-bs3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','宝山区.html');
+                    break;
+                case 'area-jd2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','嘉定区.html');
+                    break;
+                case 'area-pdx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','浦东新区.html');
+                    break;
+                case 'area-js3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','金山区.html');
+                    break;
+                case 'area-sj1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','松江区.html');
+                    break;
+                case 'area-qp1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','杨浦区.html');
+                    break;
+                case 'area-fx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','奉贤区.html');
+                    break;
+                case 'area-cm1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','上海市/','崇明区.html');
+                    break;
+                default:
+                    break;
+            }
+            }// End of for loop
+            break;
+        case 'area-js2':
+            echo '江苏省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-lyg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','连云港市.html');
+                    break;
+                case 'area-ha':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','淮安市.html');
+                    break;
+                case 'area-xq':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','宿迁市.html');
+                    break;
+                case 'area-yc1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','盐城市.html');
+                    break;
+                case 'area-yz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','扬州市.html');
+                    break;
+                case 'area-tz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','泰州市.html');
+                    break;
+                case 'area-nt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','南通市.html');
+                    break;
+                case 'area-zj1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','镇江市.html');
+                    break;
+                case 'area-cz2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','常州市.html');
+                    break;
+                case 'area-wx':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','无锡市.html');
+                    break;
+                case 'area-sz2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','苏州市.html');
+                    break;
+                case 'area-nj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','南京市.html');
+                    break;
+                case 'area-xuzhou':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江苏省/','徐州市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-zj2':
+            echo '浙江省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','杭州市.html');
+                    break;
+                case 'area-nb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','宁波市.html');
+                    break;
+                case 'area-wz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','温州市.html');
+                    break;
+                case 'area-jx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','嘉兴市.html');
+                    break;
+                case 'area-huzhou':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','湖州市.html');
+                    break;
+                case 'area-sx':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','绍兴市.html');
+                    break;
+                case 'area-jh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','金华市.html');
+                    break;
+                case 'area-qz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','衢州市.html');
+                    break;
+                case 'area-zs1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','舟山市.html');
+                    break;
+                case 'area-tz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','台州市.html');
+                    break;
+                case 'area-ls':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','浙江省/','丽水市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+
+        case 'area-ah2':
+            echo '安徽省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hf':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','合肥市.html');
+                    break;
+                case 'area-wuhu':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','芜湖市.html');
+                    break;
+                case 'area-bb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','蚌埠市.html');
+                    break;
+                case 'area-hn':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','淮南市.html');
+                    break;
+                case 'area-mas':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','马鞍山市.html');
+                    break;
+                case 'area-hb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','淮北市.html');
+                    break;
+                case 'area-tl2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','铜陵市.html');
+                    break;
+                case 'area-aq':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','安庆市.html');
+                    break;
+                case 'area-hs1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','黄山市.html');
+                    break;
+                case 'area-fy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','阜阳市.html');
+                    break;
+                case 'area-suzhou':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','宿州市.html');
+                    break;
+                case 'area-ch':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','巢湖市.html');
+                    break;
+                case 'area-la':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','六安市.html');
+                    break;
+                case 'area-bz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','豪州市.html');
+                    break;
+                case 'area-cs3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','池州市.html');
+                    break;
+                case 'area-xc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','宣城市.html');
+                    break;
+                case 'area-czs281':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','安徽省/','滁州市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-fj2':
+            echo '福建省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-fz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','福州市.html');
+                    break;
+                case 'area-xm':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','厦门市.html');
+                    break;
+                case 'area-sm1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','三明市.html');
+                    break;
+                case 'area-pt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','莆田市.html');
+                    break;
+                case 'area-qz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','泉州市.html');
+                    break;
+                case 'area-zz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','漳州市.html');
+                    break;
+                case 'area-np':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','南平市.html');
+                    break;
+                case 'area-ly2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','龙岩市.html');
+                    break;
+                case 'area-nd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','福建省/','宁德市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-jx5':
+            echo '江西省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-nc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','南昌市.html');
+                    break;
+                case 'area-jdz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','景德镇市.html');
+                    break;
+                case 'area-px':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','萍乡市.html');
+                    break;
+                case 'area-jj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','九江市.html');
+                    break;
+                case 'area-xy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','新余市.html');
+                    break;
+                case 'area-yt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','鹰潭市.html');
+                    break;
+                case 'area-gz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','赣州市.html');
+                    break;
+                case 'area-ja':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','吉安市.html');
+                    break;
+                case 'area-yc2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','宜春市.html');
+                    break;
+                case 'area-fz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','抚州市.html');
+                    break;
+                case 'area-sr':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','江西省/','上饶市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-sd1':
+            echo '山东省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-jn':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','济南市.html');
+                    break;
+                case 'area-qd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','青岛市.html');
+                    break;
+                case 'area-zb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','淄博市.html');
+                    break;
+                case 'area-zz2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','枣庄市.html');
+                    break;
+                case 'area-dy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','东营市.html');
+                    break;
+                case 'area-wf':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','潍坊市.html');
+                    break;
+                case 'area-yantai':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','烟台市.html');
+                    break;
+                case 'area-weihai':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','威海市.html');
+                    break;
+                case 'area-jn1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','济宁市.html');
+                    break;
+                case 'area-ta':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','泰安市.html');
+                    break;
+                case 'area-rz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','日照市.html');
+                    break;
+                case 'area-lw':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','莱芜市.html');
+                    break;
+                case 'area-tinyi1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','临沂市.html');
+                    break;
+                case 'area-dz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','德州市.html');
+                    break;
+                case 'area-lc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','聊城市.html');
+                    break;
+                case 'area-bz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','滨州市.html');
+                    break;
+                case 'area-heze':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山东省/','菏泽市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-gd7':
+            echo '广东省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-gz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','广州市.html');
+                    break;
+                case 'area-sz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','深圳市.html');
+                    break;
+                case 'area-foshan':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','佛山市.html');
+                    break;
+                case 'area-zh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','珠海市.html');
+                    break;
+                case 'area-dg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','东莞市.html');
+                    break;
+                case 'area-zq':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','肇庆市.html');
+                    break;
+                case 'area-yj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','阳江市.html');
+                    break;
+                case 'area-zj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','湛江市.html');
+                    break;
+                case 'area-sg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','韶关市.html');
+                    break;
+                case 'area-mz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','梅州市.html');
+                    break;
+                case 'area-hy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','河源市.html');
+                    break;
+                case 'area-hz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','惠州市.html');
+                    break;
+                case 'area-sw':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','汕尾市.html');
+                    break;
+                case 'area-zs':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','中山市.html');
+                    break;
+                case 'area-yf':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','云浮市.html');
+                    break;
+                case 'area-jm':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','江门市.html');
+                    break;
+                case 'area-mm':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','茂名市.html');
+                    break;
+                case 'area-qy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','清远市.html');
+                    break;
+                case 'area-cz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','潮州市.html');
+                    break;
+                case 'area-st':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','汕头市.html');
+                    break;
+                case 'area-jy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广东省/','揭阳市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-gxzzzzq1':
+            echo '广西壮族自治区'."\r\n";
+                     $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-nn':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','南宁市.html');
+                    break;
+                case 'area-lz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','柳州市.html');
+                    break;
+                case 'area-gl':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','桂林市.html');
+                    break;
+                case 'area-wuzhou':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','梧州市.html');
+                    break;
+                case 'area-bh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','北海市.html');
+                    break;
+                case 'area-fcg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','防城港市.html');
+                    break;
+                case 'area-qz2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','钦州市.html');
+                    break;
+                case 'area-gg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','贵港市.html');
+                    break;
+                case 'area-yl':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','玉林市.html');
+                    break;
+                case 'area-baise':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','百色市.html');
+                    break;
+                case 'area-hezhou':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','贺州市.html');
+                    break;
+                case 'area-hc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','河池市.html');
+                    break;
+                case 'area-lb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','来宾市.html');
+                    break;
+                case 'area-cz5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','广西壮族自治区/','崇左市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-hn144':
+            echo '海南省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hk':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','海南省/','海口市.html');
+                    break;
+                case 'area-sanya':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','海南省/','三亚市.html');
+                    break;
+                case 'area-szxhzdw':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','海南省/','省直辖行政单位.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-bj':
+            echo '北京市'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-dc11':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','东城区.html');
+                    break;
+                case 'area-xc21':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','西城区.html');
+                    break;
+                case 'area-cw4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','崇文区.html');
+                    break;
+                case 'area-xw9':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','宣武区.html');
+                    break;
+                case 'area-cy13':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','朝阳区.html');
+                    break;
+                case 'area-ft3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','丰台区.html');
+                    break;
+                case 'area-sjs1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','石景山区.html');
+                    break;
+                case 'area-hd8':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','海淀区.html');
+                    break;
+                case 'area-mtg1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','门头沟区.html');
+                    break;
+                case 'area-fs7':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','房山区.html');
+                    break;
+                case 'area-tz6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','通州区.html');
+                    break;
+                case 'area-sy19':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','顺义区.html');
+                    break;
+                case 'area-cp3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','昌平区.html');
+                    break;
+                case 'area-dx12':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','大山区.html');
+                    break;
+                case 'area-hr3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','怀柔区.html');
+                    break;
+                case 'area-pg3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','平谷区.html');
+                    break;
+                case 'area-yq4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','延庆县.html');
+                    break;
+                case 'area-my5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','北京/','密云县.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-tj':
+            echo '天津市'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hp7':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','和平区.html');
+                    break;
+                case 'area-hd9':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','河东区.html');
+                    break;
+                case 'area-hx10':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','河西区.html');
+                    break;
+                case 'area-nk2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','南开区.html');
+                    break;
+                case 'area-hb5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','河北区.html');
+                    break;
+                case 'area-hq5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','红桥区.html');
+                    break;
+                case 'area-tg3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','塘沽区.html');
+                    break;
+                case 'area-dg5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','大港区.html');
+                    break;
+                case 'area-dl9':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','东丽区.html');
+                    break;
+                case 'area-xq5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','西青区.html');
+                    break;
+                case 'area-jn10':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','津南区.html');
+                    break;
+                case 'area-bc6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','北辰区.html');
+                    break;
+                case 'area-wq5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','武清.html');
+                    break;
+                case 'area-bd3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','宝坻.html');
+                    break;
+                case 'area-jx18':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','蓟县.html');
+                    break;
+                case 'area-nh6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','宁河.html');
+                    break;
+                case 'area-jh16':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','天津市/','静海.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-hb12':
+            echo '河北省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-sjz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','石家庄.html');
+                    break;
+                case 'area-ts':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','唐山县.html');
+                    break;
+                case 'area-qhd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','秦皇岛.html');
+                    break;
+                case 'area-hd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','邯郸县.html');
+                    break;
+                case 'area-xt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','邢台市.html');
+                    break;
+                case 'area-bd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','保定市.html');
+                    break;
+                case 'area-zjk':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','张家口市.html');
+                    break;
+                case 'area-cd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','承德市.html');
+                    break;
+                case 'area-cz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','沧州市.html');
+                    break;
+                case 'area-lf':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','廊坊市.html');
+                    break;
+                case 'area-hs':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','河北省/','衡水市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-sx15':
+            echo '山西省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-ty':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','太原市.html');
+                    break;
+                case 'area-dt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','大同市.html');
+                    break;
+                case 'area-yq':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','阳泉市.html');
+                    break;
+                case 'area-zz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','长治市.html');
+                    break;
+                case 'area-jc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','晋城市.html');
+                    break;
+                case 'area-sz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','朔州市.html');
+                    break;
+                case 'area-jz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','晋中市.html');
+                    break;
+                case 'area-yc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','运城市.html');
+                    break;
+                case 'area-xz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','忻州市.html');
+                    break;
+                case 'area-linfen':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','临汾市.html');
+                    break;
+                case 'area-lld':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','山西省/','吕梁地区.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-nmg1':
+            echo '内蒙古自治区'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-hhht':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','呼和浩特市.html');
+                    break;
+                case 'area-bt':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','包头市.html');
+                    break;
+                case 'area-wh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','乌海市.html');
+                    break;
+                case 'area-cf':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','赤峰市.html');
+                    break;
+                case 'area-tl':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','通辽市.html');
+                    break;
+                case 'area-eeds':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','鄂尔多斯市.html');
+                    break;
+                case 'area-hlbe':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','呼伦贝尔市.html');
+                    break;
+                case 'area-wlcbm':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','乌兰察布盟.html');
+                    break;
+                case 'area-xlglm':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','锡林郭勒盟.html');
+                    break;
+                case 'area-bynem':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','巴彦淖尔盟.html');
+                    break;
+                case 'area-als':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','阿拉善盟.html');
+                    break;
+                case 'area-xa':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','内蒙古自治区/','兴安盟.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-ln8':
+            echo '辽宁省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-sy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','沈阳市.html');
+                    break;
+                case 'area-dl':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','大连市.html');
+                    break;
+                case 'area-as':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','鞍山市.html');
+                    break;
+                case 'area-fs':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','抚顺市.html');
+                    break;
+                case 'area-bx':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','本溪市.html');
+                    break;
+                case 'area-dd':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','丹东市.html');
+                    break;
+                case 'area-jz1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','锦州市.html');
+                    break;
+                case 'area-hld':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','葫芦岛市.html');
+                    break;
+                case 'area-yk':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','营口市.html');
+                    break;
+                case 'area-pj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','盘锦市.html');
+                    break;
+                case 'area-fx':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','阜新市.html');
+                    break;
+                case 'area-ly':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','辽阳市.html');
+                    break;
+                case 'area-tl1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','铁岭市.html');
+                    break;
+                case 'area-cy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','辽宁省/','朝阳市.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-jl14':
+            echo '吉林省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-zc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','长春市.html');
+                    break;
+                case 'area-jl':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','吉林市.html');
+                    break;
+                case 'area-sp':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','四平市.html');
+                    break;
+                case 'area-ly1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','辽源市.html');
+                    break;
+                case 'area-th':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','通化市.html');
+                    break;
+                case 'area-bs1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','白山市.html');
+                    break;
+                case 'area-sy1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','松原市.html');
+                    break;
+                case 'area-bc':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','白城市.html');
+                    break;
+                case 'area-ybcxzzzz':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','吉林省/','延边朝鲜族自治州.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-hlj1':
+            echo '黑龙江省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-heb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','哈尔滨市.html');
+                    break;
+                case 'area-qqhe':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','齐齐哈尔市.html');
+                    break;
+                case 'area-hg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','鹤岗市.html');
+                    break;
+                case 'area-sys':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','双鸭山市.html');
+                    break;
+                case 'area-jx':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','鸡西市.html');
+                    break;
+                case 'area-dq':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','大庆市.html');
+                    break;
+                case 'area-yichun':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','伊春市.html');
+                    break;
+                case 'area-mdj':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','牡丹江市.html');
+                    break;
+                case 'area-jms':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','佳木斯市.html');
+                    break;
+                case 'area-qth':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','七台河市.html');
+                    break;
+                case 'area-hh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','黑河市.html');
+                    break;
+                case 'area-suihua':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','绥化市.html');
+                    break;
+                case 'area-dxald':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','黑龙江省/','大兴安岭地区.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-cq':
+            echo '重庆市'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-yz12':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','渝中区.html');
+                    break;
+                case 'area-ddk1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','大渡口区.html');
+                    break;
+                case 'area-jb2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','江北区.html');
+                    break;
+                case 'area-spb1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','沙坪坝区.html');
+                    break;
+                case 'area-jlp1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','九龙坡区.html');
+                    break;
+                case 'area-na4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','南岸区.html');
+                    break;
+                case 'area-bb3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','北碚区.html');
+                    break;
+                case 'area-ws4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','万盛区.html');
+                    break;
+                case 'area-sq5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','双桥区.html');
+                    break;
+                case 'area-yb1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','渝北区.html');
+                    break;
+                case 'area-bn1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','巴南区.html');
+                    break;
+                case 'area-wz5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','万州区.html');
+                    break;
+                case 'area-fl2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','涪陵区.html');
+                    break;
+                case 'area-qj5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','黔江区.html');
+                    break;
+                case 'area-cs6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','长寿区.html');
+                    break;
+                case 'area-hc9':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','合川市.html');
+                    break;
+                case 'area-yc146':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','永川市.html');
+                    break;
+                case 'area-nc6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','南川市.html');
+                    break;
+                case 'area-qj6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','綦江县.html');
+                    break;
+                case 'area-tn4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','潼南县.html');
+                    break;
+                 case 'area-tl7':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','铜梁县.html');
+                    break;
+                case 'area-dz4':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','大足县.html');
+                    break;
+                case 'area-rc5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','荣昌县.html');
+                    break;
+
+                    case 'area-bs5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','璧山县.html');
+                    break;
+                 case 'area-dj3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','垫江县.html');
+                    break;
+                 case 'area-wl6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','武隆县.html');
+                    break;
+                case 'area-fd3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','丰都县.html');
+                    break;
+                case 'area-ck1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','成口县.html');
+                    break;
+
+                    case 'area-lp3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','梁平县.html');
+                    break;
+                case 'area-kx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','开县.html');
+                    break;
+                 case 'area-wx5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','巫溪县.html');
+                    break;
+                case 'area-ws5':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','巫山县.html');
+                    break;
+                case 'area-fj3':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','奉节县.html');
+                    break;
+
+                 case 'area-yy10':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','云阳县.html');
+                    break;
+                case 'area-zx6':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','忠县.html');
+                    break;
+                case 'area-sztjzzzx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','石柱土家族自治县.html');
+                    break;
+                case 'area-psmztjzzzx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','彭水苗族土家族自治县.html');
+                    break;
+
+                 case 'area-yytjzmzzzx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','酉阳土家族苗族自治县.html');
+                    break;
+                  case 'area-xstjzmzzzx1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','重庆市/','秀山土家族苗族自治县.html');
+                    break;
+                default:
+                    break;
+            }
+            }
+            break;
+        case 'area-sc12':
+            echo '四川省'."\r\n";
+         $innerareaarr=$this->getInnerAreaArr($host,$path,$areas[$i]);
+            for ($j = 0; $j < count($innerareaarr); $j++) {
+            switch ($innerareaarr[$j]) {
+                case 'area-cd2':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','成都市.html');
+                    break;
+                case 'area-zg':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','自贡市.html');
+                    break;
+                case 'area-pzh':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','攀枝花市.html');
+                    break;
+                case 'area-zhou9':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','泸州市.html');
+                    break;
+                case 'area-deyang':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','德阳市.html');
+                    break;
+                case 'area-my':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','绵阳市.html');
+                    break;
+                case 'area-gy':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','广元市.html');
+                    break;
+                case 'area-sn':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','遂宁市.html');
+                    break;
+                case 'area-nj1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','内江市.html');
+                    break;
+                case 'area-leshan':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','乐山市.html');
+                    break;
+                case 'area-nc1':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','南充市.html');
+                    break;
+                case 'area-yb':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','宜宾市.html');
+                    break;
+                case 'area-ga':
+                    $this->createPageByUrl($host,'/'.$innerareaarr[$j].'-0-0-1-1-1.shtml','四川省/','广安市.html');
+                    break;