使用php怎么实现一个查询百度和google收录情况的功能-创新互联
使用php怎么实现一个查询百度和google收录情况的功能?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
代码如下:
$seodetail = array();
$domain = !empty($_GET['q']) ? $_GET['q'] : 'www.mycodes.net';
baidudetail($domain);
googledetail($domain);
var_dump($seodetail);
function baidudetail($domain) {
$baidu_site = '/tupian/20230522/baidu . $domain;
$baidu_link = '/tupian/20230522/baidu . $domain;
$baidu_domain = '/tupian/20230522/baidu . $domain;
getdetail($baidu_site, 'baidu_site', '相关网页', '篇,用时');
getdetail($baidu_link, 'baidu_link', '相关网页', '篇,用时');
getdetail($baidu_domain, 'baidu_domain', '相关网页', '篇,用时');
}
function googledetail($domain) {
$google_site = '/tupian/20230522/search . $domain;
$google_link = '/tupian/20230522/search . $domain;
getdetail($google_site, 'google_site', ' 个结果,', ' 个。 (搜索用时');
getdetail($google_link, 'google_link', '约有 ', ' 项链接到 '); //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;
}
?>
看完上述内容,你们掌握使用php怎么实现一个查询百度和google收录情况的功能的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
新闻名称:使用php怎么实现一个查询百度和google收录情况的功能-创新互联
分享网址:http://myzitong.com/article/gogco.html