$DOM = new DOMDocument();
@$DOM->loadHTML($html);
$finder = new DomXPath($DOM);
$classname = 'winning-numbers';
$nodes = $finder->query("//*[contains(@class, '$classname')]");
foreach ($nodes as $node) {
echo "<p>","<b>11 AM Draw:","\n",$node->nodeValue,"</b>","</p>";
// I add paragraph and bold tags on the echo output but this site recognize the tags.
}
I'm almost done with it. The problem is I want to output like this
11 AM Draw: 111(just an example value)
4 PM Draw: 222(just an example value)
9 PM Draw: 333(just an example value)
but I'm getting this
11 AM Draw: 2-2-0
11 AM Draw: 7-7-2
11 AM Draw: 1-6-1
Use the
str_replace
function to find and replace characters in your string: