I'm pulling a string from a remote file into PHP and trying to parse out some pieces of the file. Here is an example of the file:
<SERVICE id="0">serviceid<Pounds>6</Pounds><Postage>34.00</Postage></SERVICE><SERVICE id="1">serviceid<Pounds>6</Pounds><Postage>56.00</Postage></SERVICE>
I'd like to write a regular expression that would grab both prices and put them into an array.. I've written the following code:
ereg("(<Postage>)(.*)(</Postage>)",$myLine, $p);
but it returns everything from the first tag to the very last postage tag and EVERYTHING in between. I know why it is doing this, but I am unsure how to correct the problem.. Can anyone point me in the right direction??
Many Thanks!
Charles