Jump to content


Photo

Grabbing a table from html


  • Please log in to reply
No replies to this topic

#1 clarencek

clarencek
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 03 July 2006 - 07:50 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users