2019最新百度关键词排名批量查询工具
本帖最后由 无名小银 于 2019-6-28 11:29 编辑百度关键词排名批量查询,可以批量查询一个网站的所有关键词,支持查询100名以内
演示网站:
https://www.bunian.cn/gongjv/bdrk/
网站截图
核心源代码
function curl($key,$pn=0)
{
$pn= "";
if($pn){
$pn= "&pn=".(($pn*50)-50);
}
$url = "https://www.baidu.com/s?ie=utf8&wd=". urlencode($key) ."&rn=50".$pn;
set_time_limit(0);
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS,20);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 40);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
preg_match('/<div id=\"content_left\">(.*?)<div style=\"clear:both;height:0;\"><\/div>/is', $result, $matches);
return $matches;
}
function wordkey($word,$site)
{
$bd=curl($word).curl($word,'2');
preg_match_all('/<(.*?) id=\"({1,4})\"(.*?)>(.*?)<div class="f13">(.*?)<\/a>/is', $bd , $matches);
$lid=$matches;
$id=array();
foreach($matches as $key => $value){
if(strpos($value,$site) !== false){
$id[]=$lid[$key];
}
}
return json_encode([
'word'=>$word,
'site'=>$site,
'rank'=>$id,
]);
}
土豪通道:
Github通道
https://github.com/bunian/baidu-key-rk
稳坐第一楼,谢谢分享 感谢分享源码! 不错,挺实用的! 谢谢,收藏备用了! 这个源码挺实用的 感谢分享~~ 感谢老哥分享,额可惜不懂php!!
感谢分享,非常实用的源码,收藏备用了! 感谢分享。~~