wie man XML-Datei von URL mit PHP liest

Habe ich zum Lesen einer XML-Datei aus einer URL

$map_url = "http://maps.google.com/maps/api/directions/xml?origin=".$merchant_address_url."&destination=".$customer_address_url."&sensor=false";

Dieser gibt mir eine URL wie:

http://maps.google.com/maps/api/directions/xml?origin=Quentin+Road+Brooklyn%2C+New+York%2C+11234+United+States&destination=550+Madison+Avenue+New+York%2C+New+York%2C+10001+United+States&sensor=false

Ich bin über diese Funktion zu Lesen und dann get-Daten:

 $response_xml_data = file_get_contents($map_url);
 if($response_xml_data){
     echo "read";
 }

 $data = simplexml_load_string($response_xml_data);
 echo "<pre>"; print_r($data); exit; 

Aber kein Glück, keine Hilfe?

InformationsquelleAutor der Frage Asif hhh | 2012-09-22

Schreibe einen Kommentar