您当前的位置:首页 > 计算机 > 服务器 > 万维网站 > 网站优化

检测某个链接是否被360搜索引擎收录

时间:11-01来源:作者:点击数:

做个记录备份一下。

以下函数主要用到curl,so,主机必须开启curl支持,否则将无法正常使用。

function so_360($url){
  $url='https://www.so.com/s?q='.$url;
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  $res=curl_exec($curl);
  curl_close($curl);
  if(strpos($res,'找不到该URL')){
    return 1;
  } else {
    return 0;
  }
}
$check_urls=array(
  "http://www.cdsy.xyz/computer/servers/iis/20200830/cd15987831294572.html",
  "http://downloads.cdsy.xyz/software/windows_soft/chat/chat_tools/20201031/dd160410745433.html",
  "http://guoxue.cdsy.xyz/wmwh/gdkx/20200904/gx1599186870140.html"
);
foreach ($check_urls as $url){
  if(so_360($url) == 0) {
    echo '<p style="color:green;">已收录此链接:<a target="_blank" href="https://www.so.com/s?q='.$url.'">'.$url.'</a></p>';
  } else {
    echo '<p style="color:red;">未收录此链接:<a target="_blank" href="https://www.so.com/s?q='.$url.'">'.$url.'</a></p>';
  }
}

注:仅限检测360搜索收录结果,百度、搜狗等理论上修改对应域名和搜索参数也可以,具体自测;

另:检测数量不要太多,否则耗时会很长;

还有,如果出现中文乱码,请在最上方加入:

header("Content-type:text/html;charset=utf-8");

 

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门