For some reason I simply can't get my head around how to do this. I'm using alexa web information service. I can retrieve the xml file easy enough.
Example:
HTML Code:
<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:RequestId>6c5adfea-ee7d-42d0-89a9-738b2bf4768e</aws:RequestId>
</aws:OperationRequest><aws:UrlInfoResult><aws:Alexa>
<aws:ContentData>
<aws:DataUrl type="canonical">jokeaday.com/</aws:DataUrl>
<aws:Asin>B00006BY9E</aws:Asin>
<aws:SiteData>
<aws:Title>Joke a Day</aws:Title>
<aws:Description>Features jokes, one liners, twisted tunes, and quotes.Includes paid access to babe of the day and personals.</aws:Description>
<aws:OnlineSince>17-Dec-1996</aws:OnlineSince>
</aws:SiteData>
<aws:AdultContent>no</aws:AdultContent>
</aws:ContentData>
<aws:TrafficData>
<aws:DataUrl type="canonical">jokeaday.com/</aws:DataUrl>
<aws:Asin>B00006BY9E</aws:Asin>
<aws:Rank>73529</aws:Rank>
<aws:ContributingSubdomains>
<aws:ContributingSubdomain>
<aws:DataUrl>jokeaday.com</aws:DataUrl>
<aws:TimeRange>
<aws:Months>1</aws:Months>
</aws:TimeRange>
<aws:Reach>
<aws:Percentage>98%</aws:Percentage>
</aws:Reach>
<aws:PageViews>
<aws:Percentage>97%</aws:Percentage>
<aws:PerUser>3.0</aws:PerUser>
</aws:PageViews>
</aws:ContributingSubdomain>
<aws:ContributingSubdomain>
<aws:DataUrl>forums.jokeaday.com</aws:DataUrl>
<aws:TimeRange>
<aws:Months>1</aws:Months>
</aws:TimeRange>
<aws:Reach>
<aws:Percentage>14%</aws:Percentage>
</aws:Reach>
<aws:PageViews>
<aws:Percentage>3%</aws:Percentage>
<aws:PerUser>3.7</aws:PerUser>
</aws:PageViews>
</aws:ContributingSubdomain>
</aws:ContributingSubdomains>
<aws:UsageStatistics>
<aws:UsageStatistic>
<aws:TimeRange>
<aws:Months>3</aws:Months>
</aws:TimeRange>
<aws:Rank>
<aws:Value>73,954</aws:Value>
<aws:Delta>+11,088</aws:Delta>
</aws:Rank>
<aws:Reach>
<aws:Rank>
<aws:Value>71,089</aws:Value>
<aws:Delta>+14,064</aws:Delta>
</aws:Rank>
<aws:PerMillion>
<aws:Value>17.5</aws:Value>
<aws:Delta>-26%</aws:Delta>
</aws:PerMillion>
</aws:Reach>
<aws:PageViews>
<aws:PerMillion>
<aws:Value>0.8</aws:Value>
<aws:Delta>-14%</aws:Delta>
</aws:PerMillion>
<aws:Rank>
<aws:Value>93,805</aws:Value>
<aws:Delta>+9,887</aws:Delta>
</aws:Rank>
<aws:PerUser>
<aws:Value>3.2</aws:Value>
<aws:Delta>+7%</aws:Delta>
</aws:PerUser>
</aws:PageViews>
</aws:UsageStatistic>
<aws:UsageStatistic>
<aws:TimeRange>
<aws:Months>1</aws:Months>
</aws:TimeRange>
<aws:Rank>
<aws:Value>86,403</aws:Value>
<aws:Delta>+17,456</aws:Delta>
</aws:Rank>
<aws:Reach>
<aws:Rank>
<aws:Value>85,629</aws:Value>
<aws:Delta>+20,641</aws:Delta>
</aws:Rank>
<aws:PerMillion>
<aws:Value>14.5</aws:Value>
<aws:Delta>-22%</aws:Delta>
</aws:PerMillion>
</aws:Reach>
<aws:PageViews>
<aws:PerMillion>
<aws:Value>0.7</aws:Value>
<aws:Delta>-19%</aws:Delta>
</aws:PerMillion>
<aws:Rank>
<aws:Value>106,609</aws:Value>
<aws:Delta>+17,253</aws:Delta>
</aws:Rank>
<aws:PerUser>
<aws:Value>3.5</aws:Value>
<aws:Delta>+13%</aws:Delta>
</aws:PerUser>
</aws:PageViews>
</aws:UsageStatistic>
<aws:UsageStatistic>
<aws:TimeRange>
<aws:Days>7</aws:Days>
</aws:TimeRange>
<aws:Rank>
<aws:Value>88,537</aws:Value>
<aws:Delta>+423</aws:Delta>
</aws:Rank>
<aws:Reach>
<aws:Rank>
<aws:Value>82,560</aws:Value>
<aws:Delta>-4,451</aws:Delta>
</aws:Rank>
<aws:PerMillion>
<aws:Value>15</aws:Value>
<aws:Delta>+3%</aws:Delta>
</aws:PerMillion>
</aws:Reach>
<aws:PageViews>
<aws:PerMillion>
<aws:Value>0.63</aws:Value>
<aws:Delta>-7%</aws:Delta>
</aws:PerMillion>
<aws:Rank>
<aws:Value>119,168</aws:Value>
<aws:Delta>+7,123</aws:Delta>
</aws:Rank>
<aws:PerUser>
<aws:Value>2.8</aws:Value>
<aws:Delta>-20%</aws:Delta>
</aws:PerUser>
</aws:PageViews>
</aws:UsageStatistic>
<aws:UsageStatistic>
<aws:TimeRange>
<aws:Days>1</aws:Days>
</aws:TimeRange>
<aws:Rank>
<aws:Value>73,580</aws:Value>
<aws:Delta>-831</aws:Delta>
</aws:Rank>
<aws:Reach>
<aws:Rank>
<aws:Value>62,203</aws:Value>
<aws:Delta>-16,004</aws:Delta>
</aws:Rank>
<aws:PerMillion>
<aws:Value>20</aws:Value>
<aws:Delta>+33%</aws:Delta>
</aws:PerMillion>
</aws:Reach>
<aws:PageViews>
<aws:PerMillion>
<aws:Value>0.8</aws:Value>
<aws:Delta>-20%</aws:Delta>
</aws:PerMillion>
<aws:Rank>
<aws:Value>109,185</aws:Value>
<aws:Delta>+19,532</aws:Delta>
</aws:Rank>
<aws:PerUser>
<aws:Value>2.5</aws:Value>
<aws:Delta>-40%</aws:Delta>
</aws:PerUser>
</aws:PageViews>
</aws:UsageStatistic>
</aws:UsageStatistics>
</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>
I'm retrieve it via the following bit of code:
PHP Code:
...
$result = $this->make_http_request($request_url);
$doc = new DOMDocument();
$doc->loadXML($result);
When I echo $doc->saveHTML() the file shows alright, so that's not the problem.
My problem is, how do I retrieve the following bits of data from the xml file:- aws: Title
- aws: Description
- aws: OnlineSince
- aws: AdultContent
- aws: Value & aws: Delta where aws: Months = 3
(there are spaces in the tag names to prevent those god damn smilies)
Any help would be greatly appreciated. This has got me tearing my hair out at the moment.
Bookmarks