Jump to content

Archived

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

clarencek

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++){
  print_r($links[$i]);
  echo "<br />";
  }

Thanks.

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.