使用php怎么實現(xiàn)一個查詢百度和google收錄情況的功能?相信很多沒有經(jīng)驗的人對此束手無策,為此本文總結了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個問題。
代碼如下:
<?php
$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', '相關網(wǎng)頁', '篇,用時');
getdetail($baidu_link, 'baidu_link', '相關網(wǎng)頁', '篇,用時');
getdetail($baidu_domain, 'baidu_domain', '相關網(wǎng)頁', '篇,用時');
}
function googledetail($domain) {
$google_site = '/tupian/20230522/search . $domain;
$google_link = '/tupian/20230522/search . $domain;
getdetail($google_site, 'google_site', '</b> 個結果,', ' 個。 (搜索用時');
getdetail($google_link, 'google_link', '<font size=-1>約有 <b>', '</b> 項鏈接到 <b>'); //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;
}
?>
看完上述內(nèi)容,你們掌握使用php怎么實現(xiàn)一個查詢百度和google收錄情況的功能的方法了嗎?如果還想學到更多技能或想了解更多相關內(nèi)容,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
文章標題:使用php怎么實現(xiàn)一個查詢百度和google收錄情況的功能-創(chuàng)新互聯(lián)
標題來源:http://sd-ha.com/article20/gogco.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、網(wǎng)頁設計公司、自適應網(wǎng)站、標簽優(yōu)化、微信小程序、虛擬主機
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)