Code: Select all
$feed = "http://www.mysite.com/feed.xml";
$doc = new DOMDocument();
$doc->load($feed);
$entries = $doc->getElementsByTagName("entry");
$datesUsed = array();
foreach ($entries as $entry) {
$status = $entry->getElementsByTagName("eventStatus");
$eventStatus = $status->item(0)->getAttributeNode("value")->value;
if ($eventStatus == $confirmed) {
$titles = $entry->getElementsByTagName("title");
$title = $titles->item(0)->nodeValue;
$times = $entry->getElementsByTagName("when");
$startTime = $times->item(0)->getAttributeNode("startTime")->value;
$date = date(" F j, Y", strtotime($startTime));
$time = date("g:i A", strtotime($startTime));
if (!in_array($date, $datesUsed)) {
$currentnum = count($datesUsed);
if ($currentnum > 0) echo "<br />";
echo "<strong>$date</strong><br />";
$datesUsed[$currentnum+1] = $date;
$arrayyes = 1;
}
echo $title . " - $time<br />";
}
}If these entries are not skipped, the following error occurs:
Fatal error: Call to a member function getAttributeNode() on a non-object
Thanks in advance.