您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

获取接口的参数

2025/11/14 3:03:04发布29次查看
接口如下:
http://wthrcdn.etouch.cn/weather_mini?city=北京
从浏览器上直接输入可以获取返回值
但自己用了file_get_contents(),fopen()以及curl都获取不到返回值
初学,不知道是不是自己用法的问题。
回复讨论(解决方案)
$url = 'http://wthrcdn.etouch.cn/weather_mini?city=%e5%8c%97%e4%ba%ac';echo gzdecode(file_get_contents($url));
{desc:ok,status:1000,data:{wendu:8,ganmao:昼夜温差很大,易发生感冒,请注意适当增减衣服,加强自我防护避免感冒。,forecast:[{fengxiang:北风,fengli:3-4级,high:高温 9℃,type:晴,low:低温 -4℃,date:16日星期二},{fengxiang:无持续风向,fengli:微风级,high:高温 9℃,type:晴,low:低温 -2℃,date:17日星期三},{fengxiang:北风,fengli:3-4级,high:高温 9℃,type:晴,low:低温 -2℃,date:18日星期四},{fengxiang:北风,fengli:3-4级,high:高温 7℃,type:多云,low:低温 -2℃,date:19日星期五},{fengxiang:无持续风向,fengli:微风级,high:高温 3℃,type:晴,low:低温 -5℃,date:20日星期六}],yesterday:{fl:3-4级,fx:北风,high:高温 5℃,type:晴,low:低温 -4℃,date:15日星期一},aqi:41,city:北京}}
谢版主!!!!
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product