Php: how to get Baidu snapshot date of a website; how to get Baidu snapshot _ PHP Tutorial

Source: Internet
Author: User
The php method for obtaining the Baidu snapshot date of the website to obtain the Baidu snapshot. Php: how to get the Baidu snapshot date of the website. This article describes how to get the Baidu snapshot date of the website by php. Share it with you for your reference. For details, refer to: how does php obtain the Baidu snapshot date of a website and how does php obtain Baidu snapshots?

This example describes how to obtain the date of a website Baidu snapshot by using php. Share it with you for your reference. The details are as follows:

Online demo _ php get the snapshot time of a website
 
 
 <? Php $ k = isset ($ _ POST ['K'])? $ _ POST ['K']: '';?> <? Php/* php obtains the snapshot time of a website 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 ('Enter url ');} else {if ($ r = getKuaiZhao ($ k) {echo 'snapshot :'. $ r ;}else {echo ('No snapshot') ;}}?>

I hope this article will help you with php programming.

Examples in this article describes how to obtain the Baidu snapshot date of a website by php. Share it with you for your reference. Details: 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.