How to jump into and loop through XML element
| From: | Ethan Whitt | Date: | Mon, 04 Aug 2008 11:14:39 +0000 |
| Subject: | How to jump into and loop through XML element | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-277662@lists.php.net to get a copy of this message | ||
PHP newbie coming over from Perl. Been trying to convert some of my Perl
scripts over to PHP5. I am making a request to Amazon and receiving the
following response. How can I jump down to the <Item> element and loop
through all the ones that exist. I have been trying to do this with XML
Simple, but with no success.
Thanks, Ethan
<?xml version="1.0" encoding="UTF-8"?>
<ItemSearchResponse xmlns="
http://webservices.amazon.com/AWSECommerceService/2006-11-14">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent">
</Header>
</HTTPHeaders>
<RequestId>xxxxxxxxxxxxx</RequestId>
<Arguments>
<Argument Name="SearchIndex" Value="Books">
</Argument>
<Argument Name="AssociateTag" Value="xxxxxxxxxxx">
</Argument>
<Argument Name="Service" Value="AWSECommerceService">
</Argument>
<Argument Name="Keywords" Value="Perl">
</Argument>
<Argument Name="ResponseGroup" Value="Request,Medium">
</Argument>
<Argument Name="Operation" Value="ItemSearch">
</Argument>
<Argument Name="AWSAccessKeyId" Value="xxxxxxxxxxxxxxxxxx">
</Argument>
<Argument Name="Version" Value="2006-11-14">
</Argument>
</Arguments>
<RequestProcessingTime>0.176347017288208</RequestProcessingTime>
</OperationRequest>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Keywords>Perl</Keywords>
<ResponseGroup>Medium</ResponseGroup>
<ResponseGroup>Request</ResponseGroup>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>1893</TotalResults>
<TotalPages>190</TotalPages>
<Item>