Can anyone tell me whats wrong with this code?
<?php
$feedID = '28241415';
$oddsArray = array();
$source = file_get_contents("https://www.bwin.com/partner/xml/query.aspx?source=events&lid=1&xpath=/ROOT/EVENTS/E[@LID=46%20and%20@RID=14%20and%20@SID=4]");
$xml = simplexml_load_string($source);
$game = $xml->xpath("//G");
foreach ($game as $event)
{
if ($event['DBID'] == $feedID)
{
foreach ($event->children() as $odds)
{
array_push($oddsArray, array('oddsID' => $odds['DBID'], 'odds' => $odds['O']));
}
}
}
foreach ($array as $oddsArray)
{
echo $array['odds'];
echo $array['oddsID'];
}
?>
The error I am receiving is:
Warning: Invalid argument supplied for foreach() in /home/pokerint/public_html/test.php on line
I am guessing here as the question isn’t quite clear but I think you need to reverse the order of your variables in your last foreach from
To