0
我不寫PHP代碼,以獲得與下面的代碼的地址信息:返回結果爲零時,我得到了JSON的結果,但我得到的結果,當我直接訪問鏈接
$geocode=file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address=Test Technology PTY Ltd., Rosslyn Street, Bellevue Hill, New South Wales, Australia&sensor=false');
$output= json_decode($geocode);
print $output;
for($j=0;$j<count($output->results[0]->address_components);$j++){
echo '<b>'.$output->results[0]->address_components[$j]->types[0].': </b> '.$output->results[0]->address_components[$j]->long_name.'<br/>';
}
當我打印$輸出,它顯示零結果。但是,當我直接訪問鏈接:http://maps.googleapis.com/maps/api/geocode/json?address=Test科技PTY有限公司,羅斯林街,貝爾維尤山,新南威爾士州,澳大利亞&傳感器= false在瀏覽器中。地址信息被列出。所以我想問問如何糾正我的代碼以使其工作?
非常感謝你〜
添