2012-01-31 5 views
-1

파일에 Google API의 xml 결과를 저장하려고하지만 화면에 표시하려는 경우에도 작동하지 않습니다. 어떤 아이디어?Google지도 xml 결과를 파일로 저장

<?php 
$url ="http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"; 

if (file_exists($url)) { 
    $xml = simplexml_load_file($url); 
    print_r($xml); # <-- Display in browser 
} else { 
    exit('Failed!'); 
} 
?> 

답변

1

URL에 file_exists()을 사용할 수 없습니다. file_get_contents()과 같은 코드로 바꾸면 나머지 코드는 예상대로 작동합니다.

관련 문제