PHP get Baidu included, Baidu hot word and Baidu snapshot method, php Baidu snapshot _php Tutorial

Source: Internet
Author: User
Tags echo date

PHP to get Baidu included, Baidu hot word and Baidu snapshot method, PHP Baidu snapshot


This article describes the PHP get Baidu included, Baidu hot word and Baidu snapshot method. Share to everyone for your reference. Specific as follows:

Get Baidu included:

<?php/* crawl Baidu included code */function Baidu ($s) {$baidu = "http://www.baidu.com/s?wd=site%3A". $s; $site =file_get_contents ($ Baidu); $site =iconv ("gb2312", "UTF-8", $site); Ereg ("Find related pages (. *),", $site, $count); $count =str_replace ("Find related pages", "", $count); $count =str_replace ("article,", "", $count); $count =str_replace ("About", "", $count); $count =str_replace (",", "", $count); return $count [0];} echo Baidu (Www.jb51.net); Get help home in Baidu included in the number of?>

Get Baidu's hot words

<?php/** * @return Array returns the hot Word data for Baidu (array return) */function Getbaiduhotkeyword () {$templateRss = file_get_contents (' http/ Top.baidu.com/rss_xml.php?p=top10 '); if (Preg_match ('/

This is on the Internet to find a slightly modified under the following code to write to the PHP file
Baidu included and Baidu snapshot time

<?php $domain = "http://www.bkjia.com/* Domain name to query */$site _url = ' Http://www.baidu.com/s?wd=site%3A '  ; $all = $site _url. $domain; /* Domain name all included URLs */$today = $all. '  &lm=1′;  /* Domain name included in today's URL */$utf _pattern = "/Find related results (. *)/"; $kz _pattern = "/ (. *) /"; /* String to match the snapshot date */$times = "/d{4}-d{1,2}-d{1,2}/"; /* Regular expressions that match the snapshot date, such as: 2011-8-4*/$s 0 = @file_get_contents ($all);  /* Place Site:www.jb51.net's Web page into the $s0 string */$s 1 = @file_get_contents ($today); Preg_match ($utf _pattern, $s 0, $all _num);  /* Match "find related results *" * * * Preg_match ($utf _pattern, $s 1, $today _num);  Preg_match ($kz _pattern, $s 0, $temp);  Preg_match ($times, $temp [0], $screenshot);  if ($all _num[1] = = "") $all _num[1] = 0;  if ($today _num[1] = = "") $today _num[1] = 0; if ($screenshot [0] = = "") $screenshot [0] = "no snapshot";? >  Test  
(. *) <\/table>/is ', $templateRss, $_description)) {$templateRss = $_description [0]; $templateRss = Str_replace ("& amp; "," & ", $TEMPLATERSS);} $templateRss = "<?xml version=1.0 encoding=gbk?>". $TEMPLATERSS, $xml = @simplexml_load_String ($templateRss), foreach ($xml->tbody->tr as $temp) {if (!empty ($temp- >td->a) {$keyArray [] = Trim (($temp->td->a));}} return $keyArray;} Print_r (Getbaiduhotkeyword ());
Date Baidu included Baidu today included Baidu Snapshot Date
<?php echo Date (' m ' D Day G ');? > <?php echo $all _num[1];?> <?php echo $today _num[1];?> <?php echo $screenshot [0];?>

Baidu included: "target=" _blank "> <?php echo $all _num[1];?>

Baidu today included: "target=" _blank "> <?php echo $today _num[1];?>

Baidu Snapshot Date: "> <?php echo $screenshot [0];?>

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/978386.html www.bkjia.com true http://www.bkjia.com/PHPjc/978386.html techarticle PHP to get Baidu, Baidu hot words and Baidu snapshot method, PHP Baidu Snapshot This example tells the PHP get Baidu included, Baidu hot word and Baidu snapshot method. Share for the big ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.