Php-implemented Baidu search for thieves in certain weather _ PHP Tutorial

Source: Internet
Author: User
Php-implemented Baidu searches for the thief code of a certain weather. For example, php Baidu weather thief program. Copy the code as follows :? Php retrieves weather information captured by search for xx (place name) weather in baidu $ urlwww. baidu. coms? Wd % B1 % B example, php Baidu weather thief program.

The code is as follows:


// Retrieve weather information captured by searching for xx (place name) weather in Baidu
$ 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 ('/

(. + ?) <\/Table>/Si', $ content, $ temp );
Preg_match_all ('/(. + ?) <\/Td>/Si', $ temp [1] [0], $ temp1 );
Var_dump ($ temp1 [1] [0]);

Output information:

String (243) "weather in Beijing
Today: The temperature ranges from 22 ℃ to 24 ℃. Daytime: cloudy, with large showers, and nighttime: cloudy. Dongfeng 2 to 1-2
Tomorrow: The temperature ranges from 23 ℃ to 28 ℃. Daytime: cloudy; nighttime: cloudy. Southeast wind level 2"

Bytes. The code is as follows :? Php // Get search in Baidu Inside xx (place name) weather crawled weather information $ url = "http://www.baidu.com/s? Wd = % B1 % B...

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.