当前位置:网站首页 > 更多 > 站长帮 > 正文

[Emlog教程] EMLOG 百度 360 搜狗收录php代码

作者:CC下载站 日期:2018-10-10 08:13:59 浏览:2205 分类:站长帮

1.首先在module.php内加入以下代码:

<?php
// 判断内容页是否百度收录
function baidu($url){
 $url='https://www.baidu.com/s?wd='.$url;
 $curl=curl_init();
 curl_setopt($curl,CURLOPT_URL,$url);
 curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
 $rs=curl_exec($curl);
 curl_close($curl);
if(!strpos($rs,'没有找到')){
return1;
}
else{
return0;
}
}
function checkbaidu($id){
  $url=Url::log($id);
if(baidu($url)==1){
   echo "<a style=\"color:#1EA83A;\" rel=\"external nofollow\" title=\"点击查看!\" target=\"_blank\" href=\"https://www.baidu.com/s?wd=$url\">[百度已收录]</a>";
}else{
if(ROLE =='admin'|| ROLE =='writer'){
    $urls = array($url,);
 $api ='https://data.zz.baidu.com/urls?site=www.dcqzz.cn&token=uz4sp47FTe7x10kI';
 $ch = curl_init();
 $options =  array(
     CURLOPT_URL => $api,
     CURLOPT_POST =>true,
     CURLOPT_RETURNTRANSFER =>true,
     CURLOPT_POSTFIELDS => implode("\n", $urls),
     CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),);
 curl_setopt_array($ch, $options);
 $result = curl_exec($ch);
 echo '';
}
     echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"https://zhanzhang.baidu.com/sitesubmit/index?sitename=$url\">[百度未收录]</a>";
}
}
?>
<?php
//判断内容页是否360收录
function haoso($url){
$url='https://www.so.com/s?a=index&q='.$url;
$curl=curl_init();curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);$rs=curl_exec($curl);curl_close($curl);
if(!strpos($rs,'找不到')){
return1;}
else{return0;}}
function logurlhaoso($id){$url=Url::log($id);
if(haoso($url)==1){echo "<a style=\"color:#1EA83A;\" rel=\"external nofollow\" title=\"点击查看!\" target=\"_blank\" href=\"https://www.so.com/s?a=index&q=$url\">[360已收录]</a>";
}else{echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"https://info.so.com/site_submit.html\">[360未收录]</a>";}}
?>
<?php
//判断内容页是否搜狗收录
function sogou($url){
$url='https://www.sogou.com/sie?query='.$url;
$curl=curl_init();curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);$rs=curl_exec($curl);curl_close($curl);
if(!strpos($rs,'未收录?')){
return1;}
else{return0;}}
function logurlsogou($id){$url=Url::log($id);
if(sogou($url)==1){echo "<a style=\"color:#1EA83A;\" rel=\"external nofollow\" title=\"点击查看!\" target=\"_blank\" href=\"https://www.sogou.com/sie?query=$url\">[搜狗已收录]</a>";
}else{echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"https://fankui.help.sogou.com/index.php/web/web/index/type/1?v=1&urlword=$url\">[搜狗未收录]</a>";}}
?>

2.在echo_log.php文件内调用以下代码

百度:

<?php echo checkbaidu($logid);?>

360

<?php echo logurlhaoso($logid);?>

搜狗

<?php echo logurlsogou($logid);?>


您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯