Forum Moderators: open
I am making my first attempt at working with Web Services XML data. I am trying to get the Alexa rank of a URL. Right now I am doing that using REST (php cURL) - I can switch to SOAP if need be, but I have never used that tool before and REST looked simpler. Amazon/Alexa Web Services returns this nonsense:
1GT4E4N2WHZZFS0MXYMATruecnn.net/B00006DKSD16698
I can pick out the URL (cnn.net) and the rank (16698), but how do I parse something like this? Is there a standard way to do it? If the XML looked more like an RSS feed than I would just use a regex to parse it - bit this doesn't seem to have as clear a pattern...
What should a newbie do?
Thanks!
I tried the URL you gave with REST and got actual XML results back, as below. So I'd say there is something wrong in the way you are calling the service.
<UrlInfoResponse>
<OperationRequest>
<RequestId>1F4EZ8XK8XYV05MMEK43</RequestId>
</OperationRequest>
<UrlInfoResult>
<Request>
<IsValid>True</IsValid>
</Request>
<Alexa>
<Related>
<DataUrl type="canonical">cnn.net/</DataUrl>
<Asin>B00006DKSD</Asin>
<RelatedLinks/>
</Related>
</Alexa>
</UrlInfoResult>
</UrlInfoResponse>