Home >Backend Development >PHP Tutorial >PHP website anti-link collection query google, baidu anti-link_PHP tutorial
This article is mainly about a website backlink and inclusion query written for Google and Baidu.
This article is mainly about a website backlink and inclusion query written for Google and Baidu.
if($site) {
$buffer = @file_get_contents('http://www.baidu.com/s?wd=site%3A' . $site, 'r');
if($ buffer) {
$BaiduSite = cut($buffer, 'Find relevant web pages', 'article');
$BaiduSite = str_replace(array('about', ','), '', $BaiduSite) ;
}
$buffer = @file_get_contents('http://www.baidu.com/s?wd=domain%3A' . $site, 'r');
if($buffer) {
$BaiduDomain = cut($buffer, 'Find relevant web pages', 'article');
$BaiduDomain = str_replace(array('about', ','), '', $BaiduDomain);
}
$buffer = @file_get_contents('http://www.google.cn/search?q=site%3A' . $site, 'r');
if($buffer) {
$GoogleSite = cut($buffer, 'with', ' ');
$GoogleSite = str_replace(',', '', $GoogleSite);
}
$buffer = @file_get_contents('http://www.google.cn/search?q=link%3A' . $site, 'r');
if($buffer) {
$ GoogleLink = cut($buffer, 'There are ', ' items');
$GoogleLink = str_replace(',', '', $GoogleLink);
}
}
include MooTemplate("site_index");
function cut($file, $from, $end) {
$message = explode($from, $file);
$message = explode($end, $message[1]);
return $message[0];
}