//if (checkKeywords($feed, $keywords)) { if ($getCommenters) { if ($feed['from']['id'] != $user) { if (!array_key_exists($feed['from']['id'], $retCommentersInc)) { $addCommenter = array(); $addCommenter['id'] = $feed['from']['id']; $addCommenter['name'] = $feed['from']['name']; $addCommenter['url'] = "http://www.facebook.com/profile.php?id=" . $feed['from']['id']; $retCommenters[] = $addCommenter; $retCommentersInc[$feed['from']['id']] = 1; } else { $retCommentersInc[$feed['from']['id']] = $retCommentersInc[$feed['from']['id']] + 1; } } } $posts[] = processFeed($feed, $zone, $tags); //} } } } } foreach ($retCommenters as $retCommenter) { $addCommenter = array(); foreach ($retCommenter as $key => $value) { $addCommenter[$key] = $value; } $addCommenter['cant'] = $retCommentersInc[$retCommenter['id']]; $retCommentersFinal[] = $addCommenter; } /* $handle = fopen($filename, 'w');
<?php require_once "../config.php"; require_once "../classes/DataService.php"; //get the list of feeds $feeds = DataService::singleton()->getFeeds(); //process each feed foreach ($feeds as $feed) { $messages = processFeed($feed); } function processFeed($feed) { echo "\n<br/>Checking feed: [{$feed->FeedName}] [{$feed->FeedUrl}]"; //load the xml. $feedContents = file_get_contents($feed->FeedUrl); $feedXml = simplexml_load_string($feedContents); //check if its an RSS feed. if (!$feedXml->channel->item) { echo "Is does not appear to be RSS. Atom is not supported for the moment."; return false; } //check for new messages $newItems = array(); foreach ($feedXml->channel->item as $item) { //var_dump($item); //check if message is new $timestamp = strtotime($item->pubDate); $itemDate = date('Y-m-d H:i:s', $timestamp); //echo "<br/>itemDate: {$itemDate} ++ DateLastUpdated: {$feed->DateLastUpdated}"; if ($itemDate <= $feed->DateLastUpdated) { echo "\n<br/>Item is older, skipping. Item Date: [{$itemDate}] < Date Last Updated:[{$feed->DateLastUpdated}] [{$item->title}] ";