Home  >  Article  >  Backend Development  >  php实现的百度搜索某地天气的小偷代码_PHP

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

WBOY
WBOYOriginal
2016-06-01 11:54:50838browse

例子,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级"

 

Statement:
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