Emlog判断文章是否被百度、360、搜狗收录代码

    选择打赏方式

温馨提示:
本文最后更新于2018年10月12日,已超过5年6个月(约2023天)没有更新,若内容或图片失效,请留言反馈。

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

1、判断百度是否收录:

<?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\" href=\"http://www.baidu.com/s?wd=$url\">[百度已收录]</a>";
}else{echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"http://zhanzhang.baidu.com/sitesubmit/index?sitename=$url\">[百度未收录]</a>";}}
?>

2、判断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\" 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=\"http://info.so.com/site_submit.html\">[360未收录]</a>";}}
?>

3、判断搜狗是否收录:

<?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\" href=\"https://www.sogou.com/sie?query=$url\">[搜狗已收录]</a>";
}else{echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"http://fankui.help.sogou.com/index.php/web/web/index/type/1?v=1&urlword=$url\">[搜狗未收录]</a>";}}
?>

在需要出现的地方调用代码:

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

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

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

 

版权声明:若无特殊注明,本文为《寒星皓月》原创,转载请保留文章出处。
本文链接:https://www.wanghanyue.com/post-29.html
作品采用:知识共享署名 4.0 (CC BY-NC-SA 4.0) 国际许可协议 进行许可。
正文到此结束

相关推荐

发表吐槽

你肿么看?

你还可以输入 250 / 250 个字

呵呵 哈哈 羡慕 惊恐 超赞 嗯哼 滑稽 不高兴 大哭 疑问 你懂得 打脸 黑线 委屈 小乖 酷 笑眼 汗 what 鄙视 喷 阴险 怒 吃瓜

评论信息框
可使用QQ号实时获取昵称+头像

私密评论

吃奶的力气提交吐槽中...


既然没有吐槽,那就赶紧抢沙发吧!