fork(10) download
  1. <?php
  2.  
  3. $xml = <<<_XML
  4. <?xml version="1.0"?>
  5. <aws:UrlInfoResponse xmlns:aws="http://a...content-available-to-author-only...s.com/doc/2005-10-05/">
  6. <aws:Response xmlns:aws="http://a...content-available-to-author-only...s.com/doc/2005-07-11">
  7. <aws:OperationRequest>
  8. </aws:OperationRequest>
  9. <aws:UrlInfoResult>
  10. <aws:Alexa>
  11. <aws:TrafficData>
  12. <aws:DataUrl type="canonical">google.com/</aws:DataUrl>
  13. <aws:Rank>1</aws:Rank>
  14. </aws:TrafficData>
  15. </aws:Alexa>
  16. </aws:UrlInfoResult>
  17. <aws:ResponseStatus xmlns:aws="http://a...content-available-to-author-only...s.com/doc/2005-10-05/">
  18. <aws:StatusCode>Success</aws:StatusCode>
  19. </aws:ResponseStatus>
  20. </aws:Response>
  21. </aws:UrlInfoResponse>
  22. _XML;
  23.  
  24. $xml = simplexml_load_string($xml, null, null, 'aws', true);
  25.  
  26. print_r($xml);
  27. echo $xml->Response->UrlInfoResult->Alexa->TrafficData->Rank;
Success #stdin #stdout 0.02s 20520KB
stdin
Standard input is empty
stdout
SimpleXMLElement Object
(
    [Response] => SimpleXMLElement Object
        (
            [OperationRequest] => SimpleXMLElement Object
                (
                )

            [UrlInfoResult] => SimpleXMLElement Object
                (
                    [Alexa] => SimpleXMLElement Object
                        (
                            [TrafficData] => SimpleXMLElement Object
                                (
                                    [DataUrl] => google.com/
                                    [Rank] => 1
                                )

                        )

                )

            [ResponseStatus] => SimpleXMLElement Object
                (
                    [StatusCode] => Success
                )

        )

)
1