Exemple #1
0
 function show()
 {
     $url = FoodleUtils::getUrl() . 'foodle/' . $this->foodle->identifier;
     $responses = $this->foodle->getResponses();
     $rssentries = array();
     foreach ($responses as $response) {
         #echo '<pre>'; print_r($response); echo '</pre>';
         $newrssentry = array('title' => $response->username, 'description' => 'Response: ' . self::encodeResponse($response->response['data']), 'pubDate' => $response->created);
         if (isset($entry['notes'])) {
             $newrssentry['description'] .= '<br /><strong>Comment from user: </strong><i>' . $response->notes . '</i>';
         }
         $newrssentry['description'] .= '<br />[ <a href="' . $url . '">go to foodle</a> ]';
         $rssentries[] = $newrssentry;
     }
     $rss = new RSS($this->foodle->name);
     #$rss->description = $this->foodle->description;
     $rsstext = $rss->get($rssentries);
     header('Content-Type: text/xml');
     echo $rsstext;
 }
Exemple #2
0
#!/usr/bin/php
<?php 
require 'rss.php';
require '/home/www/richtaur.com/chat/common/init.php';
$room_id = (int) $argv[1];
$url = $argv[2];
$rss = new RSS($url, $room_id);
$json = json_decode($rss->get());
if (!$json || !$json->guid) {
    exit;
}
$log .= "----------\n";
$log .= "Time: " . date('r') . "\n";
$threshold = time() - 300;
// 5 minutes ago
$time = strtotime($json->pubDate);
if ($time < $threshold) {
    $log .= "{$time} < {$threshold}, exiting ...\n";
    file_put_contents('/home/richter/tmp/chat.log', $log, FILE_APPEND);
    exit;
}
$log .= "going\n";
$tokens = explode(':', $json->description);
$name = $tokens[0];
$message = substr($json->description, strlen($name) + 2);
$message .= " (via http://twitter.com/{$name})";
/*
echo "going ahead\n";
echo "twitter time: $time\n";
echo "php time: " . time() . "\n";