This article mainly introduces the function of batch processing in PHP to detect whether a page is included in Baidu. Interested friends can refer to it. I hope it will be helpful to everyone.
The following is the specific code:
<?php /* * 检测网页是否被百度收录,返回1则表示收录 返回0表示没有收录 * @ param string $url 待检测的网址 */ function checkBaiduInclude($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; } }
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
Detailed explanation of methods and examples of PHP file upload class
Methods and examples of PHP implementation of paging class
php methods and examples for generating verification codes
The above is the detailed content of PHP implements batch processing to detect whether a page is included in Baidu. For more information, please follow other related articles on the PHP Chinese website!