PD: el codigo no esta todo comentado... aun esta en desarollo XDXDXD
Código php:
Ver original
<?php class RSS_PHP { var $xml; var $load_dom; var $channel; // var $descript; // var $title; // var $link; // var $item; // function RSS_PHP() { //tags por defecto para channel. "lastBuildDate","docs","generator","managingEditor","webMaster"); //tags por defecto para item } function getRss($xml) { //comprueba que exite algo en la variable $xml. //llama a la funcion de carga del xml else { $this->xml = $xml; return($this->load_func()); } } function load_func() { //carga el xml. $this->load_dom = new DOMDocument; $this->load_dom->load($this->xml); //comprueba que se ha cargado correctamete. if(!$this->load_dom){return(False);} else{return(True);} } function getChannel() { $this->channel = $this->load_dom->getElementsByTagName("channel"); } function getItem() { $this->item = $this->load_dom->getElementsByTagName("item"); } function getChannelInfo($info) { foreach($this->channel as $canal) { { $information = $canal->getElementsByTagName($info[$ind]); { $this->channel_all[$info[$ind]] = $information->item(0)->nodeValue; } } } return($this->channel_all); } function getItemInfo($info) { foreach($this->item as $item) { { { $tag = $item->getElemetsByTagName($info[$ind2]); //error aqui!!!! <------> { $this->item_all[$ind][$info[$ind2]] = $tag->item(0)->nodeValue; } } } } return($this->item_all); } function getTitle() { $ind = 0; foreach($this->item as $this->title) { $title = $this->title->getElementsByTagName("title"); $this->title_nom[$ind] = $title->item(0)->nodeValue; $ind++; } else{return(False);} } function getDescript() { $ind = 0; foreach($this->item as $this->descript) { $descript = $this->descript->getElementsByTagName("description"); $this->descript_nom[$ind] = $descript->item(0)->nodeValue; $ind++; } else{return(False);} } } /*$rss = new RSS_PHP; $rss->getRss("http://www.amposta.cat/rss.asp"); $item = $rss->getItemInfo(""); print_r($item);*/ ?>