Hi everyone!
I have parsed an xml feed from this source: http://odds.expekt.com/exportServlet
This is the result: http://www.cjhweb.se/
I got some help from som members from here 🙂
This is the script I am using:
<?
$dom = new DomDocument;
$dom->load('http://odds.expekt.com/exportServlet');
$dom->preserveWhiteSpace = false;
$note = $dom->getElementsByTagName('game');
foreach ($note as $value) {
$description = $value->getElementsByTagName('description')->item(0)->childNodes->item(2)->nodeValue;
$category = $value->getElementsByTagName('category')->item(0)->nodeValue;
$date= $value -> getAttribute('date');
$time= $value -> getAttribute('time');
echo $date."<br/>";
echo $time."<br/>";
echo $category.'<br />';
echo $description.'<br />';
$alt = $value->getElementsByTagName('alternative');
$length = $alt->length;
for ($index = 0; $index < $length; $index++) {
$odds = $alt->item($index)->attributes->getNamedItem('odds')->nodeValue;
$text = $alt->item($index)->nodeValue;
echo $text . ' : ' . $odds . '<br />';
}
echo '---------------' . '<br />';
}
?>
My question is how do I get this into a database? I was thinking about creating a table for each league( the category tag from the xml). But I'm not sure how to program it. Also I just want the big leagues for now, like NHL and champions league so the database don't get out of controll.
Appreciate all help I can get 🙂