php谷歌收录接口,php实现查询百度google收录情况(示例代码)
PHP
$SEOdetail = array();
$domain = !empty($_GET['q']) ? $_GET['q'] : 'www.mycodes.net';
baidudetail($domain);
googledetail($domain);
var_dump($SEOdetail);
function baidudetail($domain) {
$baidu_site = 'http://www.baidu.com/baidu?word=site%3A' . $domain;
$baidu_link = 'http://www.baidu.com/baidu?word=link%3A' . $domain;
$baidu_domain = 'http://www.baidu.com/baidu?word=domain%3A' . $domain;
getdetail($baidu_site,'baidu_site','相關(guān)網(wǎng)頁','篇,用時(shí)');
getdetail($baidu_link,'baidu_link','篇,用時(shí)');
getdetail($baidu_domain,'baidu_domain','篇,用時(shí)');
}
function googledetail($domain) {
$google_site = 'http://www.google.cn/search?hl=zh-CN&q=site%3A' . $domain;
$google_link = 'http://www.google.cn/search?hl=zh-CN&q=link%3A' . $domain;
getdetail($google_site,'google_site',' 個(gè)結(jié)果,',' 個(gè)。 (搜索用時(shí)');
getdetail($google_link,'google_link','約有 ',' 項(xiàng)鏈接到 '); //102
}
function getdetail($url,$type,$wordf,$wordb) {
$pagecontent = @file($url);
$pagecontent = implode ('',$pagecontent);
$pagecontent = substr(strstr($pagecontent,$wordf),strlen($wordf));
$pagecontent = substr_replace($pagecontent,'',strpos($pagecontent,$wordb));
returndetail($pagecontent,$type);
}
function returndetail($content,$type) {
global $SEOdetail;
$SEOdetail[$type] = empty($content) ? 0 : $content;
}
?>
總結(jié)
以上是生活随笔為你收集整理的php谷歌收录接口,php实现查询百度google收录情况(示例代码)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python图形界面库哪个好_8个必备的
- 下一篇: python随机抽签列表中的同学值日_神