Forum Moderators: open

Message Too Old, No Replies

Trying to parse XML data.

         

erikcw

10:37 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



Hi all,

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

This "scratchpad" produced the same result with both REST and SOAP.
[awszone.com...]

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!

Dijkgraaf

5:34 am on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well as that isn't XML formated data, nope, there isn't a standard way of parsing that.

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>