Jump to content


This topic is now archived and is closed to further replies.


Grabbing a table from html

Recommended Posts

Hi, I'm trying to grab a table from html using a php function preg_match_all, but it doesn't seem to work.  Is the following correct?

$url = 'http://somehtmlpage.com/blah.html';
$page = file_get_contents($url);

if (preg_match_all('/<table>(.+?)<\/table>/gi', $page, $links, PREG_SET_ORDER))

  for($i = 0; $i < count($links); $i++){
  echo "<br />";


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.