
July 5th, 2011, 05:04 PM
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 1
Time spent in forums: 34 m 2 sec
Reputation Power: 0
|
|
|
Preg_match help
Hi,
I dont know if this should be posted here or on the php page but Basically I am trying to use the code below:
Code:
<?php $eurovalue = file_get_contents("dump.txt"); $eurovalue = htmlspecialchars($eurovalue); $pattern = '/<td><a.*>USD\/EUR<\/a><\/td>.*<td\s*\w*>\s*<img\s*[\w\d]*\s*\/>(\d+)<\/td>/si'; preg_match($pattern,$eurovalue,$euroarray); $euroresult = $euroarray[0]; echo $euroresult; ?>
To find this code:
Code:
<td><a href="/business/currencies/quote?srcAmt=1&srcCurr=USD&destAmt=&destCurr=EUR">USD/EUR</a></td> <td class="data changeUp"> <img width="9" height="10" src="/resources_v2/images/changeUp.gif" />0.69070</td>
In a script that contains similar <td>'s, also the 0.69070 is subject to change. The preg_match that I am using isnt working and I cant work out why. I imagine it is something to do with the regex. The code that it is searching for is located in dump.text and this is all working fine, it just seems to be the preg_match.
Any help would be appreciated,
Thanks
Rhys
|