コード例 #1
0
define('API_KEY', 'KEY HERE');
define('SHARED_SECRET', 'KEY HERE');
define('APP_ID', 'APP ID HERE');
//instantiate session
$session = new YahooApplication(API_KEY, SHARED_SECRET, APP_ID);
//db information
$dbhostname = '###';
$dbusername = '******';
$dbpassword = '******';
$dbname = '###';
//connect to database and get all users
mysql_connect($dbhostname, $dbusername, $dbpassword) or die('Unable to connect to database. Please try again later.');
mysql_select_db($dbname);
$query = "SELECT * FROM user_store";
$result = mysql_query($query);
$j = 1;
//for each database user, update the small view
while (($row = mysql_fetch_assoc($result)) !== false) {
    if ($row['uid']) {
        $html = '';
        ##################################
        #CREATE HTML CODE FOR CURRENT USER
        ##################################
        if (!$session->setSmallView($row['uid'], $html)) {
            echo "{$j} : NO SESSION SET FOR {$row['uid']}<br />\n";
        } else {
            echo "{$j} : SESSION SET FOR {$row['uid']}<br />\n";
        }
        $j++;
    }
}
コード例 #2
0
    }
    $data = $application->query($yql);
    if (is_object($data) && isset($data->query->results->item)) {
        // build small view content (my yahoo)
        $content .= '<ul class="delicious">';
        foreach ($data->query->results->item as $bookmark) {
            $content .= '<li><a href="' . $bookmark->link . '">' . $bookmark->title . '</a></li>';
        }
        $content .= '</ul>';
        if ($username) {
            if (isset($_REQUEST['username'])) {
                //  username is valid (yql returned results), so save for future requests
                apc_store('user_' . $user->guid, $username);
            }
            // update small view for user bookmarks
            $application->setSmallView($user->guid, $header . $content);
        }
    } else {
        $content .= '<ul><li><a href="http://delicious.com/popular">Invalid username...</a></li></ul>';
    }
}
$content .= '</div>';
/*
 // available open tables

  use 'http://www.javarants.com/delicious/delicious.feeds.popular.xml' as delicious.feeds.popular;
  use 'http://www.javarants.com/delicious/delicious.feeds.xml' as delicious.feeds;

  use 'http://www.javarants.com/friendfeed/friendfeed.feeds.xml' as friendfeed.feeds;
  use 'http://www.javarants.com/friendfeed/friendfeed.home.xml' as friendfeed.home;
  use 'http://www.javarants.com/friendfeed/friendfeed.profile.xml' as friendfeed.profile;