function __construct() { parent::__construct(); $this->mConfig = FileUtil::GetGlobalConfig(); $this->mProxyFilePath = WEB_ROOT . "/lib/common/Proxy.php"; $data = $this->HttpRequest($this->mConfig['FRAMEWORK_DEFAULT']['PROXY_URL']); //echo $data."\n"; $this->mHtmlDom = new simple_html_dom(); //var_dump($this->mHtmlDom); $contentDom = $this->mHtmlDom->load($data); $proxyTableTrs = $contentDom->find('table[class=sortable]'); $this->mProxyArray = array(); foreach ($proxyTableTrs as $proxyTable) { $trs = $proxyTable->find("tr"); $i = 0; foreach ($trs as $tr) { //前两个tr不能用 if ($i++ < 2) { continue; } $proxyIP = $tr->find("td", 0)->innertext; $proxyPORT = $tr->find("td", 1)->innertext; $tmp["IP"] = $proxyIP; $tmp["PORT"] = $proxyPORT; $this->mProxyArray[] = $tmp; } } $this->mHtmlDom->clear(); $data = $this->HttpRequest($this->mConfig['FRAMEWORK_DEFAULT']['XC_PROXY_URL']); $contentDom = $this->mHtmlDom->load($data); $proxyTableTrs = $contentDom->find('table[id=ip_list]'); foreach ($proxyTableTrs as $proxyTable) { $trs = $proxyTable->find("tr[class=odd]"); foreach ($trs as $tr) { $proxyIP = $tr->find("td", 1)->innertext; $proxyPORT = $tr->find("td", 2)->innertext; $tmp["IP"] = $proxyIP; $tmp["PORT"] = $proxyPORT; $this->mProxyArray[] = $tmp; } } //var_dump($proxyArray); FileUtil::SaveFile($this->mProxyArray, $this->mProxyFilePath); }
<?php //处理单个帖子 require_once "entry.php"; $topicUrl = $argv[1]; $proxyIP = $argv[2]; $proxyPORT = $argv[3]; echo "topicUrl=" . $topicUrl . "\n"; echo "IP=" . $proxyIP . "\n"; echo "PORT=" . $proxyPORT . "\n"; $model = ModelUtil::GetDouBanModel(); $config = FileUtil::GetGlobalConfig(); $imgList = $model->GetPhotoByTopic($topicUrl, $proxyIP, $proxyPORT); foreach ($imgList as $imgUrl) { $cmd = $config['FRAMEWORK_DEFAULT']['PHP_PATH'] . " " . WEB_ROOT . "/download.php " . $imgUrl . " " . $proxyIP . " " . $proxyPORT . " >/dev/null &"; exec($cmd); }
function __construct() { $this->mConfig = FileUtil::GetGlobalConfig(); $this->mGroupUrl = $this->mConfig['FRAMEWORK_DEFAULT']['DOUBAN_SHINE_GROUP_URL'] . $mStart; parent::__construct(); }