<?xml version="1.0" ?>
<aws:UrlInfoResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
<aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11">
<aws:OperationRequest>
</aws:OperationRequest>
<aws:UrlInfoResult>
<aws:Alexa>
<aws:TrafficData>
<aws:DataUrl type="canonical">google.com/</aws:DataUrl>
<aws:Rank>1</aws:Rank>
</aws:TrafficData>
</aws:Alexa>
</aws:UrlInfoResult>
<aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/">
<aws:StatusCode>Success</aws:StatusCode>
</aws:ResponseStatus>
</aws:Response>
</aws:UrlInfoResponse>
我想解析的所有內容均來自此xml文檔的排名。 試圖這樣做的IAM是什麼...使用simplexml_load_file解析XML文件返回空對象
$xml= simplexml_load_file("path of the file saved");
echo $xml->Response->UrlInfoResult->Alexa->TrafficData->Rank;
,但我得到一個錯誤這樣做。它說
Notice: Trying to get property of non-object in C:\wamp\www\SEO Stats[Only Testing]\Tools\web_worth.php on line 13
的錯誤是在這一行
echo $xml->Response->UrlInfoResult->Alexa->TrafficData->Rank;
this line is referred as line no 13..
什麼是第13行? –
echo $ xml-> Response-> UrlInfoResult-> Alexa-> TrafficData-> Rank; –
只需print_r($ xml);並檢查它的內容是什麼 – Shin