emlog判断文章是否被百度、360、搜狗收录最全代码教程

博主
133
文章
13
评论
2018-10-2210:48:27 6 384 2093字

使用方法:首先在模板下的module.php 中添加以上代码

判断文章是否百度收录代码

<?php
//判断内容页是否百度收录
function baidu($url){
$url=’http://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,’没有找到’)){return 1;}else{return 0;}}

function logurl($id){$url=Url::log($id);
if(baidu($url)==1){echo "<a style="color:#1EA83A;" rel="external nofollow" title="点击查看!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cDovL3d3dy5iYWlkdS5jb20vcz93ZD0kdXJs">[百度已收录]</a>";
}else{echo "<a style="color:red;" rel="external nofollow" title="点击提交收录!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cDovL3poYW56aGFuZy5iYWlkdS5jb20vc2l0ZXN1Ym1pdC9pbmRleD9zaXRlbmFtZT0kdXJs">[百度未收录]</a>";}}
?>

判断文章是否360收录代码

<?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,’找不到’)){
return 1;}
else{return 0;}}

function logurlhaoso($id){$url=Url::log($id);
if(haoso($url)==1){echo "<a style="color:#1EA83A;" rel="external nofollow" title="点击查看!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cHM6Ly93d3cuc28uY29tL3M/YT1pbmRleCZhbXA7cT0kdXJs">[360已收录]</a>";
}else{echo "<a style="color:red;" rel="external nofollow" title="点击提交收录!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cDovL2luZm8uc28uY29tL3NpdGVfc3VibWl0Lmh0bWw=">[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,’未收录?’)){
return 1;}
else{return 0;}}
function logurlsogou($id){$url=Url::log($id);
if(sogou($url)==1){echo "<a style="color:#1EA83A;" rel="external nofollow" title="点击查看!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cHM6Ly93d3cuc29nb3UuY29tL3NpZT9xdWVyeT0kdXJs">[搜狗已收录]</a>";
}else{echo "<a style="color:red;" rel="external nofollow" title="点击提交收录!" target="_blank" rel="external nofollow" target="_blank" href="http://www.yscan.cn/wp-content/themes/begin/go.php?url=aHR0cDovL2Zhbmt1aS5oZWxwLnNvZ291LmNvbS9pbmRleC5waHAvd2ViL3dlYi9pbmRleC90eXBlLzE/dj0xJmFtcDt1cmx3b3JkPSR1cmw=">[搜狗未收录]</a>";}}
?>

在你想显示的地方添加调用代码调用代码:

百度<?php echo logurl($logid);?> 或者<?php echo logurlbaidu($logid);?> 

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

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

emlog判断文章是否被百度、360、搜狗收录最全代码教程

  • 版权声明: 发表于 2018-10-2210:48:27
  • 转载注明:http://www.yscan.cn/post-34.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

评论:6   其中:访客  0   博主  0
    • avatar 一世长安 @回复 5

      @CW:谢谢

      • avatar CW @回复 0

        Thanks very interesting blog!

        • avatar 好萌 @回复 5

          @网站建设:刚发就来,这么快点速度。。。

          • avatar 网站建设 @回复 3

            学习了

            • avatar 网站建设 @回复 3

              学习了