<a target="_blank" href="http://www.baidu.com/link?url=817rWbYacmQXiwy9EjXljTZjqik-XiMvSliYlfCmBya" class="c-showurl" style="text-decoration:none;">www.sbanzu.com/ </a><a target="_blank" href="http://www.baidu.com/link?url=817rWbYacmQXiwy9EjXljTZjqik-XiMvSliYlfCmBya" class="c-showurl" style="text-decoration:none;">www.sbanzu.com/ </a><a target="_blank" href="http://www.baidu.com/link?url=817rWbYacmQXiwy9EjXljTZjqik-XiMvSliYlfCmBya" class="c-showurl" style="text-decoration:none;">www.sbanzu.com/ </a>
我想通过class =c-showurl 才采集 a 标签的链接我改怎么写???
echo $pat='/<a .*?href="(.*?)" class="c-showurl">(.*?)</a> /';
preg_match_all($pat,$v,$out);
我想通过class =c-showurl 才采集 a 标签的链接我改怎么写???
echo $pat='/<a .*?href="(.*?)" class="c-showurl">(.*?)</a> /';
preg_match_all($pat,$v,$out);
preg_match_all($pat,$v,$out);
print_r($out);
$_POST['url'] = ""if($_POST['url']){$url=explode("\r\n", $_POST['url']);
//p($url);
foreach ($url as $k => $v) {
$v=trim($v);
if($v){
$baidunum =100;
for($i=0;$i<$baidunum;$i++){
$page=$i*10;
$burl[]="http://www.baidu.com/baidu?wd=$v&pn=$page";
}
}
}
$res=Curl_http($burl,30);
$resurl=array();
foreach($res as $k=>$v){
$pat='#<div class="f13"><a .*?href="(.*?)" class="c-showurl"[^>]*>(.*?)</a>#is';
preg_match_all($pat,$v,$out);
$resurl=array_merge($resurl,$out[0]);
print_r($out);
die;
}
p($out);
$resurl=actionurl($resurl);
//2015-12-17p($pat);foreach($resurl as $k=>$v){
$vl.=",('','$v',1)";
}$vl=trim($vl,',');
$query = "INSERT INTO cjurl_url(id,url,deep)VALUES $vl ; ";
$dsql->ExecuteNoneQuery($query);
showmsg("增加成功,继续采集","index.php");
exit();
}?>