Hello guyz, I'm glad I finally back here.

I need help using the preg_match function.
I am scraping url and I need to get the specific value from the html tags.
Here is the string <p><b>1,664</b> Referring IP addresses</p>, I need to get 1,664 How can I achieve it using php?

Recommended Answers

preg_match('@<p><b>(.*?)</b>@i', '<p><b>1,664</b> Referring IP addresses</p>', $matches);
print_r($matches);
Jump to Post

All 2 Replies

preg_match('@<p><b>(.*?)</b>@i', '<p><b>1,664</b> Referring IP addresses</p>', $matches);
print_r($matches);

Thank you pritaeas, it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.