ciao!
ho questa classe qua:
il problema è questo.Codice PHP:
class RssReader {
private $xmlUrl;
private $xmlDoc;
private $items;
public function __construct($xmlUrl) {
$this->xmlUrl = $xmlUrl;
$this->xmlDoc = new DOMDocument();
$this->xmlDoc->load($this->xmlUrl);
$this->items = $this->xmlDoc->getElementsByTagName('item');
}
public function getItems($c) {
$arrayItems = array();
for ($i = 0; $i <= $c; $i++) {
$arrayItems['i_titolo'] = $this->items->item($i)->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue; // ERRORE
echo $arrayItems['i_titolo'];
}
return $arrayItems;
}
}
quando richiamo la funzione getItems, mi vengono stampate tutte le voci,
ma ottengo anche questo errore alla riga dove ho messo il commento:
com'è possibile??codice:Fatal error: Call to a member function getElementsByTagName() on a non-object