Regular acquisition problems, solving, online, etc.
Target page: http://www.weather.com.cn/weather/101070101.shtml
View its web page source code, want 425 rows of data, namely "Today is October 16, 2013 Wednesday lunar September 12" and 621 lines "Shenyang Weather Forecast (2013-10-16 18:00)" and 641 rows ~765 between the main data. In the picture, see:
In addition, I wrote a rule, and tried to take the following data "Shenyang Weather Forecast (2013-10-16
11:00 release) "But after input is an empty array, please guide!" Thanks a lot!
Share to:
------Solution--------------------
1
$s =file_get_contents (' http://www.weather.com.cn/weather/101070101.shtml ');
Preg_match ('/\s+ (. +) \s+<\!--today5-->/s ', $s, $m);
echo $m [1];
2
Preg_match ('/\s+\s+ (. +?) \s+/s ', $s, $m);
echo $m [1];
3 don't know what format data you want to get.