php baidu 收錄查詢程式_PHP教程

來源:互聯網
上載者:User

php教程 baidu 收錄查詢程式
*/
header('content-type: text/html; charset=utf-8');
require('function.php');

$url = strtolower(trim($_get['url']));
$lm = intval($_get['lm']);
$pn = intval($_get['pn']);

$url = getshorturl($url);

if (empty($pn)) $pn = 1;

switch ($lm) {
case 1 :
$timestr = '24小時';
break;
case 7 :
$timestr = '一星期';
break;
case 30 :
$timestr = '一個月';
break;
case 360 :
$timestr = '一年';
break;
default :
$timestr = '所有時間';
break;
}
?>



if (empty($url)) {
?>
35dir百度近日收錄查詢-35分類目錄


} else {
?>
<?php echo $url;?>百度最近<?php echo $timestr; ?>收錄詳情-35分類目錄


}
?>







網站導航:35分類目錄 | open directory







if (!empty($url)) {
?>
按時間段查詢: 最近24小時  最近一星期  最近一個月  最近一年  總收錄量

$query_url = 'http://www.baidu.com/s?wd=site%3a'.$url.'&pn='.$pn.'&lm='.$lm;
$line_arr = @file($query_url);

$content = implode('###', $line_arr);
$content = @mb_convert_encoding($content, 'utf-8', 'gb2312');

//index
if (preg_match('/找到相關網頁(.*?)篇/i', $content, $index)) {
$baiduindex = str_replace('約', '', $index[1]);
} else {
$baiduindex = '-';
}
?>

百度在最近 內共收錄了網站( " target="_blank"> ) 個頁面



$content = strstr($content, '
$end = strpos($content, '');
$content = substr($content, 0, $end);

$item_arr = explode('', $content);

//showpage
if (preg_match('/

(.*?)/', $content, $page_arr)) {
$showpage = str_replace('s?wd=site%3a', '?url=', $page_arr[1]);
$showpage = str_replace('[', '', $showpage);
$showpage = str_replace(']', '', $showpage);
}

$i = 0;
$strhtml = '

    ';
    foreach ($item_arr as $item) {
    if (preg_match('/(.*?)
    (.*?)(.*?) - /i', $item, $siteinfo)) {
    $sitename = $siteinfo[3];
    $siteurl = $siteinfo[2];
    $sitedesc = $siteinfo[4];
    $siteltime = $siteinfo[5];
    $sitecache = $siteinfo[6];

    $strhtml .= '
  • ';
    $strhtml .= ''.$i.'.'.$sitename.'';
    $strhtml .= '

    '.$sitedesc.'

    ';
    $strhtml .= ''.$siteltime.' - 百度快照';
    $strhtml .= '
  • ';
    }
    $i++;
    }
    $strhtml .= '
';
$strhtml .= ''.$showpage.'';

echo $strhtml;
?>



}
?>



function檔案

function getfullurl($url) {
if ($url != "") {
$url_parts = parse_url($url);
if ($url_parts['scheme'] == "") {
$url = "http://".$url;
}
}
return $url;
}

function getshorturl($url) {
if ($url != "") {
$url_parts = parse_url($url);
if ($url_parts['host'] == "") {
$url = $url_parts['path'];
} else {
$url = $url_parts['host'];
}
}
return $url;
}

function format_number($number) {
if ($number == '') return "-";
$nlen = strlen($number);
while ($nlen > 3) {
$fnumber = ",".substr($number, $nlen - 3, 3).$fnumber;
$number = substr($number, 0, -3);
$nlen = strlen($number);
}

if ($nlen <= 3) {
$fnumber = $number.$fnumber;
}
return $fnumber;
}
?>

源碼下載地址

http://down.bKjia.c0m/s/2010/1025/21415.html

http://www.bkjia.com/PHPjc/631737.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631737.htmlTechArticlephp教程 baidu 收錄查詢程式 */ header('content-type: text/html; charset=utf-8'); require('function.php'); $url = strtolower(trim($_get['url'])); $lm = intval($_get['lm']); $...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.