$rss_tags = array(
'drawNo',
'drawTime',
'result',
);
$rss_item_tag = 'draw';
$rss_url = "http://applications.opap.gr/DrawsRestServices/kino/drawDate/21-12-2014.xml";
$rssfeed = rss_to_array($rss_item_tag,$rss_tags,$rss_url);
echo '<pre>';
print_r($rssfeed);
/*$total=1;
foreach($rssfeed as $item)
{
if($total<750){
echo '<div><h1>Κλήρωση: '.$item['drawNo']. ' Αριθμοί: ' .$item['result'].'</h1></div>';
$total++;
}
}
*/
function rss_to_array($tag, $array, $url) {
$doc = new DOMdocument();
$doc->load($url);
$rss_array = array();
$items = array();
foreach($doc->getElementsByTagName($tag) AS $node) { //se auth thn epanalhpsh epanalamvenete toses fores oses oi klhrwseis tis hmeras
foreach($array AS $key => $value) { //$array einai ta rss tags
if($value=="result"){
for($i=1;$i<=20;$i++){$items["result"] = $node->getElementsByTagName("result")->item(0)->nodeValue;}
}
$items[$value] = $node->getElementsByTagName($value)->item(0)->nodeValue;
}
array_push($rss_array, $items);
}
return $rss_array;
}
Hello phpers, this is my code to read some xml information but i have a big big big problem.
Firstly check the xml source: http://applications.opap.gr/DrawsRestServices/kino/drawDate/21-12-2014.xml
The structure is like that:
<draws>
<draw>
<drawNo>
<drawTime>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
<result>
and my code returns only the first entry of the but i want to get both 20 entries could someone help me?