示例#1
0
function test_friendfeed()
{
    header("Content-Type: text/plain");
    // Fill in a nickname and a valid remote key below for authenticated
    // actions like posting an entry and reading a protected feed
    // $session = new FriendFeed($_POST["nickname"], $_POST["remote_key"]);
    $session = new FriendFeed();
    $feed = $session->fetch_public_feed();
    // $feed = $session->fetch_user_feed("bret");
    // $feed = $session->fetch_user_feed("paul", "twitter");
    // $feed = $session->fetch_user_discussion_feed("bret");
    // $feed = $session->fetch_multi_user_feed(array("bret", "paul", "jim"));
    // $feed = $session->search("who:bret friendfeed");
    foreach ($feed->entries as $entry) {
        print $entry->title . "\n";
    }
    if ($session->auth_nickname && $session->auth_key) {
        // The feed that the authenticated user would see on their home page
        $feed = $session->fetch_home_feed();
        // Post a message on this user's feed
        $entry = $session->publish_message("Testing the FriendFeed API");
        print "Posted new message at http://friendfeed.com/e/" . $entry->id . "\n";
        // Post a link on this user's feed
        $entry = $session->publish_link("Testing the FriendFeed API", "http://friendfeed.com/");
        print "Posted new link at http://friendfeed.com/e/" . $entry->id . "\n";
        // Post a link with two thumbnails on this user's feed
        $entry = $session->publish_link("Testing the FriendFeed API", "http://friendfeed.com/", "Test comment on this test entry", array("http://friendfeed.com/static/images/jim-superman.jpg", "http://friendfeed.com/static/images/logo.png"));
        print "Posted images at http://friendfeed.com/e/" . $entry->id . "\n";
    }
}
示例#2
0
<?php

require_once "friendfeed.php";
$uploaded = false;
$entry = null;
if ($_POST["title"]) {
    $uploaded = true;
    $friendfeed = new FriendFeed($_POST["nickname"], $_POST["remotekey"]);
    $entry = $friendfeed->publish_link($_POST["title"], $_POST["link"]);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>FriendFeed Remote Login Form</title>
    <style type="text/css">

      body {
        background-color: white;
	margin: 25px;
      }

      body, input {
	color: #222222;
	font-family: Arial, sans-serif;
	font-size: 10pt;
      }

      h1 {
        font-size: 20pt;