我想读从PHP一个JSON这样的:读取外部JSON在PHP
[{
"titulo": "DontAsk",
"pais": "Austria",
"country_iso": "AT",
"direccion": "Mag. Th. Langmann Gmbh Landstrasse 4",
"cp_ciudad": "A-2000 STOCKERAU",
"lat": "48.385583",
"long": "16.207823",
"telefono": "43-2266-72554-11",
"fax": "43-2266-72554-44",
"web": "www.aaa.com"
}, {
"titulo": "Other One",
"pais": "Czech Republic",
"country_iso": "CZ",
"direccion": "Pod Cihelnou 6",
"cp_ciudad": "664 161 00 PRAHA 6",
"lat": "50.092605",
"long": "14.312707",
"telefono": "420 233 313 578",
"fax": "420 233 313 582",
"web": "www.bbb.com"
}]
的JSON有没有错误,我试着用JsonLint,发现它干净。 我有更多的插入,但我只是推杆2.
然后我尝试代码行这样的:
$json = json_decode(file_get_contents($url), true);
var_dump($json);
的URL返回检索URL不错,但在返回的var_dump NULL
我看到了很多答案和问题,并没有找到答案。 有些帮助?
读JSON - >在阵列转换在PHP - >提取的阵列中的上述代码
由于
可能的重复[如何从JSON提取数据与PHP?](http://stackoverflow.com/questions/29308898/how-do-i-extract-data-from-json-with-php) –
你有什么问题? –
这个JSON字符串用'json_decode'正确解析。 https://3v4l.org/3Qn0V检查'file_get_contents($ url)'是否给你预期的结果。 –