Arkane Posted September 12, 2009 Share Posted September 12, 2009 HEy, I'm trying to write a script to get data off of another site (with admins approval) but I'm having a bit of a problem to take the actual data. I'm trying to use preg_match to find the data I need, but just cant get the thing to work for anything more complicated that telling me if there is a t in test. <td class="reltdd">Serial Code</td> <td class="reltdv">5445-9826</td> This is the html that i am trying to scrape. theres more, but its all the same pretty much. What I'm looking to get is the '5445-9826' but since the td is a class that is referred to multiple times, the only thing unique to the date is the 'Serial Code' text. I've gotten the site info via file_get_contents() and its all in the one variable - $raw . I've tried preg_match("/<td class="reltdd">(.*)</td>/", $html, $matches); echo $matches; but it had no return whatsoever. i have also echoed $html so I know it got the data correctly. I know that what I have there should only return 'Serial Code' but sinceI can't even get that to work I have no chance with the rest. Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/173990-taking-information-from-a-site/ Share on other sites More sharing options...
DEVILofDARKNESS Posted September 12, 2009 Share Posted September 12, 2009 This is supposed to be in the regex section! Link to comment https://forums.phpfreaks.com/topic/173990-taking-information-from-a-site/#findComment-917172 Share on other sites More sharing options...
Arkane Posted September 12, 2009 Author Share Posted September 12, 2009 Ok, my mistake, sorry. Link to comment https://forums.phpfreaks.com/topic/173990-taking-information-from-a-site/#findComment-917181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.