I have been trying to create a foreach loop that will get every ListingId from the XML file but for some reason I can only get one 'Id'
XML STRUCTURE:
<List>
<Listing>
<ListingId></ListingId>
</Listing>
<Listing>
<ListingId></ListingId>
</Listing>
<Listing>
<ListingId></ListingId>
</Listing>
</List>
PHP:
$xml = simplexml_load_file("domain.co.nz/xml.xml");
foreach($xml->List->Listing->ListingId as $value)
{
$xmlArray[] = $value;
}
SimpleXMLends up being less simple thanDOMfor any non-trivial XML processing. You'll be much better served to learn how to useDOMinstead.