PHP get the website Baidu Snapshot Date method, get Baidu snapshot _php tutorial

Source: Internet
Author: User
Tags php website

PHP get Baidu Snapshot Date method, get Baidu Snapshot


The example of this article is about how PHP gets the snapshot date of Baidu website. Share to everyone for your reference. Specific as follows:

Online demo _php Get snapshot time for a website
 
  
 
  
 
  <?php $k =isset ($_post[' K '])? $_post[' K ']: ';? ><?php/*  php gets snapshot time for a site by Enenba  2012-6-18  @ Param str $url First-level domain name  @param str time format */function Getkuaizhao ($text) {  $url = ' http://www.baidu.com/s?word= '. $text ;  $html = file_get_contents ($url);  $text = Str_replace ('. ', ' \. ', Addslashes ($text));  $search = '/'. $text. ' <\/b>[^<]* ((?: 19|20) [0-9]{2}-(?: 1[012]|[ 1-9])-(?: [12][0-9]|3[01]|[ 1-9]))/';  Preg_match ($search, $html, $r);  Highlight_string ($search);  return $r [1];} if ($k = = ") {  echo (' Please enter URL ');} else{  if ($r = Getkuaizhao ($k)) {    echo ' snapshot: '. $r;   } else {    echo (' no snapshot ');}  }? >

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

http://www.bkjia.com/PHPjc/1039191.html www.bkjia.com true http://www.bkjia.com/PHPjc/1039191.html techarticle PHP to get the website Baidu Snapshot Date method, get Baidu Snapshot This article describes the PHP website Baidu Snapshot Date method. Share to everyone for your reference. Specific as follows: H ...

  • 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.