Exemplo n.º 1
0
 /**
  * 获取综述页链接
  * @param NB_Request $input
  * @param NB_Response $output
  */
 public function doGetDetailLink(NB_Request $input, NB_Response $output)
 {
     NB_File::write(time(), "{$this->proRoot}/Html/data/log.txt");
     $timeout = $this->timeout;
     $list = file("{$this->proRoot}/Html/{$this->catdatafilename}");
     if ($list) {
         foreach ($list as $link) {
             $detailLink = "";
             $key = trim($link);
             $detailLinkDataFileName = md5($link) . ".txt";
             if (file_exists("{$this->proRoot}/Html/data/{$detailLinkDataFileName}")) {
                 continue;
             }
             $gamelist = NB_Api::run("Service.FetchHtml.getHtmlOrDom", array('url' => $link, 'charset' => 'UTF-8', 'timeout' => $timeout, 'getDom' => 1, 'referer' => 'www.google.com.hk', 'proxy' => '1'));
             if ($gamelist) {
                 foreach ($gamelist->find('div[class=column]') as $div) {
                     foreach ($div->find("ul li") as $innli) {
                         #综述页链接
                         $deLink = $innli->children(0)->href;
                         echo $deLink . "success\n";
                         $detailLink .= $deLink . "\n";
                         sleep(10);
                     }
                 }
                 $detailLink .= "{$this->data[$key]}\n";
                 NB_File::write($detailLink, "{$this->proRoot}/Html/data/{$detailLinkDataFileName}");
             } else {
                 echo "catch detail error";
             }
         }
     } else {
         echo "empty list";
     }
     exit;
 }