Hi,
I have the following xml feed:
<tour>
<tourName>Amazon Riverboat Adventure</tourName>
<dossierCode>PVIIA</dossierCode>
<tripDetails>
<tripDetail type="StartFinish">ex Lima</tripDetail>
<tripDetail type="What's Included">Lots of stuff </tripDetail>
<tripDetail type="Whats not included">Not much </tripDetail>
</tripDetails>
I need a way to be able to save each of the tripDetails as a seperate value. The “types” are always constant and i have a list of them.
I therefore want to be able to say $startfinish = ‘ex Lima’, $whatsincluded = ‘Lots of stuff’ etc.
The code i have so far is:
[php]
<?php if(!$xml=simplexml_load_file('xmlfeed.xml')){ trigger_error('Error reading XML file',E_USER_ERROR); } foreach ($xml->tourName as $tourname) foreach ($xml->dossierCode as $agentcode) ?>[/php]
which obviously get’s me the first two instances of the XML. When i move onto the tripDetail section though, i tried to use:
[php]
foreach ($xml->tripDetails->tripDetail[0] as $startfinish)[/php]
this didn’t produce anything. If i remove the [ 0 ], it just displays the last result in the array.
I have been told how to get all the data via var_dump but this isn’t what i need. I need to be able to have $startfinish as ‘ex lima’ etc.
Any help - greatly appreciated!
Many thanks!