0

I am trying to get the content within td tags from html,

<?php
 $link = $_POST['link'];
 $data = file_get_contents($link);

 //echo $data;
 $regex ='"!<td>(.*?)</td>!is"';;
 preg_match_all($regex, $data, $matches);
 var_dumP($matches);    
?>

it seems it can get the result, but when I var_dump it, it only have the following result,

array (size=2)
0 => 
array (size=0)
  empty
1 => 
array (size=0)
  empty

it seems can get the something from the regular expression, but the array is empty, cannot show the html content in it. Anything wrong with my regular expression?

want_to_be_calm
  • 1,477
  • 3
  • 23
  • 41

0 Answers0