Home >php教程 >php手册 >PHP检测url地址是否被百度收录

PHP检测url地址是否被百度收录

WBOY
WBOYOriginal
2016-06-07 11:37:161501browse

php检测网站的URL地址是否被百度收录(curl模式),其实很简单,不多说了,上代码吧。
PHP检测url地址是否被百度收录function checkBaidu($url) { <br>     $url = 'http://www.baidu.com/s?wd=' . urlencode($url); <br>     $curl = curl_init(); <br>     curl_setopt($curl, CURLOPT_URL, $url); <br>     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); <br>     $rs = curl_exec($curl); <br>     curl_close($curl); <br>     if (!strpos($rs, '没有找到')) { //没有找到说明已被百度收录 <br>         return 1; <br>     } else { <br>         return -1; <br>     } <br> }<br> $url = 'http://www.sucaihuo.com/js'; <br> echo checkBaidu($url);结果显示:已收录
在线检测url百度收录表单:http://www.sucaihuo.com/js/450.html

附件 PHP判断url链接是否被百度收录.zip ( 3 KB 下载:43 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn