php 网站反链接收录查询 google,baidu反链_PHP教程
本款主要是针对google,baidu来写的一款网站反链与收录查询哦,
if($site) {
$buffer = @file_get_contents('http://www.baidu.com/s?wd=site%3A' . $site, 'r');
if($buffer) {
$BaiduSite = cut($buffer, '找到相关网页', '篇');
$BaiduSite = str_replace(array('约', ','), '', $BaiduSite);
}
$buffer = @file_get_contents('http://www.baidu.com/s?wd=domain%3A' . $site, 'r');
if($buffer) {
$BaiduDomain = cut($buffer, '找到相关网页', '篇');
$BaiduDomain = str_replace(array('约', ','), '', $BaiduDomain);
}
$buffer = @file_get_contents('http://www.google.cn/search?q=site%3A' . $site, 'r');
if($buffer) {
$GoogleSite = cut($buffer, '有 ', ' ');
$GoogleSite = str_replace(',', '', $GoogleSite);
}
$buffer = @file_get_contents('http://www.google.cn/search?q=link%3A' . $site, 'r');
if($buffer) {
$GoogleLink = cut($buffer, '有 ', ' 项');
$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];
}
上一篇: php的幻术函数和魔术常量