how to read xml file from url using php

后端 未结 5 1072
广开言路
广开言路 2020-12-03 07:02

I have to read an XML file from an URL

$map_url = \"http://maps.google.com/maps/api/directions/xml?origin=\".$merchant_address_url.\"&destination=\".$cus         


        
5条回答
  •  渐次进展
    2020-12-03 07:33

    you can get the data from the XML by using "simplexml_load_file" Function. Please refer this link

    http://php.net/manual/en/function.simplexml-load-file.php

    $url = "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";
    $xml = simplexml_load_file($url);
    print_r($xml);
    

提交回复
热议问题