0

I've following code:

$url = "HERE URL";
$handle = curl_init($url);
curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($handle);    
print_r($result);
if (preg_match('<tr><td>Listeners (current):</td><td class="streamstats">(.*) 
</td></tr>', $result, $matches)) {
    print_r($matches);
}
curl_close($handle);

I want to get the data from td class "streamstats", but its a whole table, with more class streamstats. What im doing wrong?

Thanks in advance.

BlackNetworkBit
  • 768
  • 11
  • 21
Marv
  • 33
  • 11
  • Please provide with the `$result` output – pr1nc3 Sep 06 '18 at 14:14
  • Your RegEx is wrong. It must start and end with same symbol. E.g. `/(.*).../` – Justinas Sep 06 '18 at 14:17
  • Possible duplicate of [Using regular expressions to parse HTML: why not?](https://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not) – Justinas Sep 06 '18 at 14:20
  • The remote website is a full website. I only need the numbers that are here: Listeners (current):158 The 158 number is changing every second, And i need that number. – Marv Sep 06 '18 at 14:21
  • [Don't use regexes for parsing HTML](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – John Conde Sep 06 '18 at 17:29

0 Answers0