Jump to content

XML Parsing


jbashir

Recommended Posts

I want to parse XML coming from this URL:

http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1DN1Y0GF2HTSA76NRQG2&Operation=BrowseNodeLookup&ResponseGroup=BrowseNodeInfo&BrowseNodeId=1000

 

I want Children->BrowseNode->BrowseNodeId and Children->BrowseNode->Name from this XML.

 

I have tried this code:

$url = http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1DN1Y0GF2HTSA76NRQG2&Operation=BrowseNodeLookup&ResponseGroup=BrowseNodeInfo&BrowseNodeId=1000
$xml = new SimpleXMLElement($url,null,true);
foreach($xml as $node) {
echo $node->BrowseNode->BrowseNodeId."-". $BrowseNode->BrowseNode->Name;
}

But I only get this output :

 

1000 - Subjects (And I do not get further output).

 

Can someone please help me to solve this problem.

Link to comment
https://forums.phpfreaks.com/topic/91039-xml-parsing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.