Hopefully someone can help me with this:
I want to add a condition to this parser so that it only shows games from 1 certain league.
The problem is that the league name is in the node above called "pool". Is there any way to solve this?
This is the script I have so far:
$dom = new DomDocument;
$dom->load('http://ads-cdn.unibet.com/orval/feed/uk/en/sportsBookCopy.xml');
$dom->preserveWhiteSpace = false;
$note = $dom->getElementsByTagName('event');
foreach ($note as $value) {
$name= $value -> getAttribute("name");
echo $name . '<br />';
$alt = $value->getElementsByTagName('outcome');
$alt2 = $value->getElementsByTagName('price');
$length = $alt->length;
for ($index = 0; $index < $length; $index++) {
$label = $alt->item($index)->attributes->getNamedItem('label')->nodeValue;
$odds = $alt2->item($index)->attributes->getNamedItem('odds')->nodeValue;
echo $label . ' : ' . $odds . '<br />';
}
echo '---------------' . '<br />';
}