Home > Backend Development > PHP Tutorial > PHP implemented Baidu search weather thief code in a certain place_PHP tutorial

PHP implemented Baidu search weather thief code in a certain place_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:31:56
Original
1095 people have browsed it

Example, php Baidu Weather Thief program.

Copy code The code is as follows:

//Get search for xx in Baidu Weather information captured by (place name) weather
$url = "http://www.baidu.com/s?wd=%B1%B1%BE%A9%CC%EC%C6%F8"; // This is the return address for searching Beijing weather in Baidu
$content = file_get_contents($url);
preg_match_all('/
(.+?) /si',$content,$temp);
preg_match_all('/(.+?)/si',$temp[1][0],$temp1);
var_dump ($temp1[1][0]);

Output information:

string(243) "Beijing weather
Today: temperature 22℃ - 24℃. Daytime: cloudy, heavy showers, night: cloudy. East wind level 2 to level 1-2
Tomorrow: temperature 23℃ - 28℃. Daytime: cloudy, night time: southeasterly wind level 2"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/759965.htmlTechArticleExample, php Baidu Weather Thief program. Copy the code as follows: ?php //Get the weather information captured by searching for xx (place name) weather in Baidu $url = "http://www.baidu.com/s?wd=%B1%B...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template