Yesideez Posted November 25, 2010 Share Posted November 25, 2010 Hi, I have a page of HTML and inside this page is a TABLE and it's this table I need to extract some data from. <th>Proxy:</th><td><span class="red">Confirmed proxy server.</span> (<a href="/proxy-server">Read about proxy servers</a>)</td> The first TH cell will always have that content but I need to extract everything between the next TD cell including the HTML. I can strip any HTML out myself if present, just needing help with Regex as I have no clue whatsoever about this as I just cannot get my head around it and I've spent hours! Any help with this would be gratefully appreciated. Link to comment https://forums.phpfreaks.com/topic/219800-extracting-content-from-a-table/ Share on other sites More sharing options...
JAY6390 Posted November 25, 2010 Share Posted November 25, 2010 preg_match('~<th>Proxy:</th><td>(.*?)</td>~i', $subject, $matches); echo $matches[1]; Link to comment https://forums.phpfreaks.com/topic/219800-extracting-content-from-a-table/#findComment-1139453 Share on other sites More sharing options...
Yesideez Posted November 25, 2010 Author Share Posted November 25, 2010 Oh wow is it really that simple? Thank-you for that - really is appreciated! Link to comment https://forums.phpfreaks.com/topic/219800-extracting-content-from-a-table/#findComment-1139468 Share on other sites More sharing options...
JAY6390 Posted November 25, 2010 Share Posted November 25, 2010 Yup. No problem Link to comment https://forums.phpfreaks.com/topic/219800-extracting-content-from-a-table/#findComment-1139470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.