Home > php教程 > php手册 > php实现的百度搜索某地天气的小偷代码

php实现的百度搜索某地天气的小偷代码

WBOY
Release: 2016-06-13 09:37:10
Original
920 people have browsed it

例子,php百度天气小偷程序。

复制代码 代码如下:


//获取在百度里面搜索 xx(地名)天气 抓取的天气信息
$url = "http://www.baidu.com/s?wd=%B1%B1%BE%A9%CC%EC%C6%F8"; //此为在百度里搜 北京天气 的返回地址
$content = file_get_contents($url);
preg_match_all('/

(.+?)/si',$content,$temp);
preg_match_all('/(.+?)/si',$temp[1][0],$temp1);
var_dump ($temp1[1][0]);

输出信息:

string(243) "北京天气
今天:温度22℃ - 24℃。白天:多云, 大阵雨,夜间:多云。东风2级转1-2级
明天:温度23℃ - 28℃。白天:多云,夜间:多云。东南风2级"

 

Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template