今天在舍利博客看到的,感觉加在侧边栏的统计区还可以,顺便发出来了
<?php function baiduSl($url){ $baidu="http://www.baidu.com/s?wd=site:".$url; $site=file_get_contents($baidu); ereg("该网站共有(.*)个网页被百度收录", $site,$count); $count=str_replace("该网站共有","",$count); $count=str_replace("个网页被百度收录","",$count); $count=str_replace(",","",$count); $count=str_replace(" ","",$count); return strip_tags($count[0]); } function sogouSl($url){ $sogou="http://www.sogou.com/web?query=site:".$url; $site=file_get_contents($sogou); ereg("找到约 (.*) 条结果", $site,$count); $count=str_replace("找到约","",$count); $count=str_replace("条结果","",$count); $count=str_replace(",","",$count); $count=str_replace(" ","",$count); return strip_tags($count[0]); } ?>
调用代码<?php echo baiduSl('www.aeink.com');?> <?php echo sogouSl('www.aeink.com');?>
具体怎么用我就不说了,你们自己看~
转载请注明出处 AE博客|墨渊 » PHP 获取百度和搜索收录量 代码 可用于EMLOG
发表评论