I have a php query that contains an xml file, but I want to extract certain results from that and then save them to another file.
The query string results are:
<?xml version="1.0"?>
<CasinoInfo>
<CasinoName> PhoneCasino </CasinoName>
<PartnerName> PhoneCasino </PartnerName>
<Generated> 2007-07-06 16:16:25 </Generated>
<Games>
<VideoPoker>
<title> Video Poker </title>
<about> A superb 5-Card Stud Poker game for novices and experts alike. Win 250 times your stake on a Royal Flush! Jacks or better pays out. Install NOW for free! </about>
<lastWinner> SH, Winsford just won 50 pence </lastWinner>
</VideoPoker>
<UnionJackpot>
<title> Union Jackpot </title>
<about> Britain's most patriotic fruit machine. Spin, nudge and hold your way on horizontal or diagonal lines to win. Install NOW for free! </about>
<jackpot>
<progressive>
<formatted> £2,451.29 </formatted>
<penceInteger> 245129 </penceInteger>
</progressive>
</jackpot>
<lastWinner> JG, Dewsbury just won £1.00 </lastWinner>
</UnionJackpot>
<Roulette>
<title> Roulette </title>
<about> Probably the best Casino game in the world... Put a REAL Roulette game on your phone and place your chips on all your favourite combinations and patterns. Install NOW for free! </about>
<lastWinner> CH, Dagenham just won £9.00 </lastWinner>
</Roulette>
<Blackjack>
<title> Blackjack </title>
<about> Beat the dealer to 21 and double your money! Bet as much or as little as you like, from 10p upwards. Install NOW for free! </about>
<lastWinner />
</Blackjack>
<Nudge7>
<title> Nudge7 </title>
<about> Nudge, hold and spin your way to our progressive jackpot which goes up with every spin! Install NOW for free! </about>
<jackpot>
<progressive>
<formatted> £1,138.27 </formatted>
<penceInteger> 113827 </penceInteger>
</progressive>
</jackpot>
<lastWinner> IH, Merthyr Tydfil just won 10 pence </lastWinner>
</Nudge7>
<MoneyBeach>
<title> Money Beach </title>
<about> Who thought you could ever make money by hitting the beach? You could win up to 50 times your stake! Install NOW for free! </about>
<lastWinner> DR, Doncaster just won 50 pence </lastWinner>
</MoneyBeach>
<LoveMachine>
<title> Love Machine </title>
<about> Oh won't you buy me a diamond ring? (Or failing that a Mercedes Benz). Put a positive spin on Valentine's Day with the Love Machine. </about>
<jackpot>
<progressive>
<formatted> £1,113.26 </formatted>
<penceInteger> 111326 </penceInteger>
</progressive>
</jackpot>
<lastWinner> GT, DUNDEE just won £1.50 </lastWinner>
</LoveMachine>
<Hi-Lo>
<title> Hi-Lo </title>
<about> Higher! Lower! Rack up those winnings in our fast, fun and furious Hi Lo cards game! Install NOW for free! </about>
<lastWinner> JP, Exmouth just won 50 pence </lastWinner>
</Hi-Lo>
<Bingo!>
<title> Bingo! </title>
<about> Eyes down for genuine British Bingo hall style action on your mobile. Install NOW for free! </about>
<lastWinner> J in Rotherham just won &#163;5.00 </lastWinner>
</Bingo!>
</Games>
</CasinoInfo>
and I want them to be out put into:
<?xml version="1.0" encoding="utf-8" ?>
<PhoneCasino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Video Poker</Game>
<Winner> SH, Winsford just won </Winner>
<won>50 pence playing Video Poker!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Nudge7</Game>
<Winner> IH, Merthyr Tydfil just won </Winner>
<won>10 pence playing Nudge7!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Union Jackpot</Game>
<Winner>JG, Dewsbury just won </Winner>
<won>£1.00 playing Union Jackpot</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Roulette</Game>
<Winner> GS, Port Talbot just won </Winner>
<won>90 pence playing Roulette!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Love Machine</Game>
<Winner> GT, Dundee just won </Winner>
<won>£1.50 playing Love Machine!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Hilo</Game>
<Winner> JP, Exmouth just won </Winner>
<won>50 pence playing HiLo!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Money Beach</Game>
<Winner> LR, Denbigh just won </Winner>
<won>50 pence playing Money Beach!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
<Casino>
<CasinoName>Phone Casino</CasinoName>
<Game>Bingo</Game>
<Winner> T, Newark just won </Winner>
<won>£50.00 playing Money Beach!</won>
<Jackpot>1157.47</Jackpot>
</Casino>
</PhoneCasino>
I don't have any control over the xml output from the php query, but I would like to change the files because I keep getting error messages trying to get fields like jackpot>progressive>formatted to display in my browsers when I add it to the pages.
Thanks for your help
Lucy