Home  >  Article  >  Backend Development  >  PHP implements batch processing to detect whether a page is included in Baidu

PHP implements batch processing to detect whether a page is included in Baidu

墨辰丷
墨辰丷Original
2018-06-06 15:41:511304browse

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=&#39;http://www.baidu.com/s?wd=&#39;.$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,&#39;抱歉,没有找到&#39;)){ 
 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!

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