This commit is contained in:
JAE
2014-06-12 14:58:02 +08:00
parent 3b7078a1ac
commit 0261fe2f22
5 changed files with 102 additions and 28 deletions

View File

@@ -48,7 +48,7 @@ require '../QueryList.class.php';
$reg_znum='/([\d,]+) result(s)?/';
$getHtmlWay = 'curl';
}
$searcherObj = new QueryList($url,$this->regArr,$this->regRange,$getHtmlWay,false);
$searcherObj = QueryList::Query($url,$this->regArr,$this->regRange,$getHtmlWay,false);
for($i=0;$i<count($searcherObj->jsonArr);$i++)
{
if($this->searcher=='baidu')

View File

@@ -6,7 +6,7 @@ $url = "http://www.oschina.net/code/list";
$reg = array("title"=>array(".code_title a:eq(0)","text"),"url"=>array(".code_title a:eq(0)","href"),"author"=>array("img","title"));
$rang = ".code_list li";
//使用curl抓取源码并以GB2312编码格式输出
$hj = new QueryList($url,$reg,$rang,'curl','GB2312');
$hj = QueryList::Query($url,$reg,$rang,'curl','GB2312');
$arr = $hj->jsonArr;
echo "<pre>";
print_r($arr);
@@ -21,7 +21,7 @@ echo $json . "<hr/>";
//采OSC内容页内容
$url = "http://www.oschina.net/code/snippet_186288_23816";
$reg = array("title"=>array(".QTitle h1","text"),"con"=>array(".Content","html"));
$hj = new QueryList($url,$reg);
$hj = QueryList::Query($url,$reg);
$arr = $hj->jsonArr;
echo "<pre>";
print_r($arr);

BIN
demo/thanks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB