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