我想使用json_decode這個json文件,但出了問題。它幾天前工作正常,但現在返回NULL。json_decode在php中
<?php
$url = 'http://opendata.diavgeia.gov.gr/api/decisions?org=eot&output=json';
function works2($url)
{
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Connection:Keep-Alive\r\nAccept:*/*\r\n"
)
);
$context = stream_context_create($opts);
$retstr = file_get_contents($url,false,$context);
return $retstr;
}
var_dump(json_decode(works2($url)));
?>
任何人都可以幫助我嗎?
[讀取json在php]中可能的重複(http://stackoverflow.com/questions/12568135/reading-json-in-php) –
在您檢索它並查看您實際獲得的內容後,打印'$ retstr'遠程服務器。 –