本文整理汇总了PHP中TwitterAPIExchange::getTweets方法的典型用法代码示例。如果您正苦于以下问题:PHP TwitterAPIExchange::getTweets方法的具体用法?PHP TwitterAPIExchange::getTweets怎么用?PHP TwitterAPIExchange::getTweets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TwitterAPIExchange
的用法示例。
在下文中一共展示了TwitterAPIExchange::getTweets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<div class="slide" id="twitter">
<div class="container">
<h2>King's Tweets</h2>
<?php
ini_set('display_errors', 1);
require_once 'TwitterAPIExchange.php';
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array('oauth_access_token' => "16770784-7moHuZZOkEQJMaPmr3yJyUhEulyWAhXgi5hjQkzJf", 'oauth_access_token_secret' => "UVdsDQsoOuOHeLUttMwz2eqpN1OuDb6DJNzcrUCFFE", 'consumer_key' => "UpdvsamJgEibOmHXrY7FXQ", 'consumer_secret' => "6VnjiJKY4lU5PHmqMKqILvKzTgAdtaQWDqFeTYNRYU");
/** Perform a GET request and echo the response **/
/** Note: Set the GET field BEFORE calling buildOauth(); **/
$url = 'http://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=kingjames&count=5';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$tweets = $twitter->getTweets($response);
?>
<div id="wrapper-content" class="container">
<div id="horizontal-example" class="row clearfix">
<div class="grid_12 last">
<?php
if (count($tweets) > 0) {
?>
<ul class="twitter-timeline twitter-timeline-vertical clearfix">
<?php
$count = 0;
foreach ($tweets as $tweet) {
$count++;
if (isset($tweet->retweeted_status)) {
?>