This commit is contained in:
muzihuaner
2026-03-18 13:51:13 +08:00
parent 3b003d344b
commit c48adef7b1

View File

@@ -11,7 +11,7 @@ header("Content-type: text/html; charset=UTF-8");
if(!$_GET['msg'])exit("抱歉,出错了!\n请输入城市名!");
$msg = $_GET['msg'];
$n = $_GET['n'];
$str = file_get_contents("compress.zlib://http://m.nmc.cn/f/rest/autocomplete?q=$msg&limit=10&timestamp=1547115792491");//56691|威宁|553100|贵州省|weining|AGZ
$str = file_get_contents("http://m.nmc.cn/f/rest/autocomplete?q=$msg&limit=10&timestamp=1547115792491");//56691|威宁|553100|贵州省|weining|AGZ
$str=str_replace('|','<br>',$str);
$str = str_replace(PHP_EOL,'<hr><hr>', $str);
$str = "<hr>".$str."<hr>";
@@ -22,7 +22,7 @@ echo "搜索不到与".$_GET["msg"]."的相关天气,请稍后重试或换个
}else{
if($result== 1){
$a=$trstr[1][0];
$data = file_get_contents("compress.zlib://http://m.nmc.cn/f/rest/real/".$a."");
$data = file_get_contents("http://m.nmc.cn/f/rest/real/".$a."");
preg_match_all('/"city":"(.*?)","province":"(.*?)"},"week":"(.*?)","moon":"(.*?)","jie_qi":"(.*?)","publish_time":"(.*?)","weather":{"temperature":(.*?),"temperatureDiff":(.*?),"airpressure":(.*?),"humidity":(.*?),"rain":(.*?),"rcomfort":(.*?),"icomfort":(.*?),"info":"(.*?)","img":"(.*?)","feelst":(.*?)},"wind":{"direct":"(.*?)","power":"(.*?)","speed":"(.*?)"},"warn":{"alert":"(.*?)","pic":"(.*?)","province":"(.*?)","city":"(.*?)","url":"(.*?)","issuecontent":"(.*?)"/',$data,$data);//1地名2省5节气6更新时间7现在温度9气压10湿度12舒适度14天气16体感温度17风向18风力19风速
$a = $data[1][0]; //小地名
$b = $data[2][0]; //省
@@ -51,7 +51,7 @@ echo "共搜索到与【".$_GET["msg"]."】的相关天气信息".$result."条
$n = $_GET['n'];
$i=($n-1);
$a=$trstr[1][$i];//id
$data = file_get_contents("compress.zlib://http://m.nmc.cn/f/rest/real/".$a."");
$data = file_get_contents("http://m.nmc.cn/f/rest/real/".$a."");
preg_match_all('/"city":"(.*?)","province":"(.*?)"},"week":"(.*?)","moon":"(.*?)","jie_qi":"(.*?)","publish_time":"(.*?)","weather":{"temperature":(.*?),"temperatureDiff":(.*?),"airpressure":(.*?),"humidity":(.*?),"rain":(.*?),"rcomfort":(.*?),"icomfort":(.*?),"info":"(.*?)","img":"(.*?)","feelst":(.*?)},"wind":{"direct":"(.*?)","power":"(.*?)","speed":"(.*?)"},"warn":{"alert":"(.*?)","pic":"(.*?)","province":"(.*?)","city":"(.*?)","url":"(.*?)","issuecontent":"(.*?)"/',$data,$data);//1地名2省5节气6更新时间7现在温度9气压10湿度12舒适度14天气16体感温度17风向18风力19风速
$a = $data[1][0]; //小地名
$b = $data[2][0]; //省