當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twitter::request方法代碼示例

本文整理匯總了PHP中Twitter::request方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::request方法的具體用法?PHP Twitter::request怎麽用?PHP Twitter::request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Twitter的用法示例。


在下文中一共展示了Twitter::request方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getenv

 function __construct($username = 'beirutspring')
 {
     // prepare the client;
     $twitterClient = new \Twitter(getenv('TWITTER_CONSUMER_KEY'), getenv('TWITTER_CONSUMER_SECRET'), getenv('TWITTER_ACCESS_TOKEN'), getenv('TWITTER_ACCESS_TOKEN_SECRET'));
     // populate info
     try {
         $this->info = $twitterClient->request('users/show', 'GET', ['screen_name' => $username]);
     } catch (Exception $e) {
         return "Exception: {$e}";
     }
 }
開發者ID:aboustayyef,項目名稱:deprecated_lb_l5,代碼行數:11,代碼來源:twitterAccountScraper.php

示例2: Twitter

$access_token = '15201275-loypZtq58TRB1qoIIu6fTw6TSEqluGZ1aMKgVJjJe';
$access_token_secret = 'haKjTuzH9N6UPhOBZDKSsu6FAZzIvLNbwGhi5wfy00Y';
$twitter = new Twitter(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $access_token, $access_token_secret);
try {
    $results = $twitter->search('#ibm');
    foreach ($results as $result) {
        echo "message: ", $result->text;
        echo "posted at ", $result->created_at;
        echo "posted by ", $result->form_user;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error searching Twitter: ", $e->getMessage();
}
try {
    $statuses = $twitter->request('statuses/retweets_of_me', 'GET', array('count' => 20));
    foreach ($statuses as $status) {
        echo "message: ", $status->text;
        echo "posted at ", $status->created_at;
        echo "posted by ", $status->form_user;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error getting statuses from Twitter: ", $e->getMessage();
}
try {
    $results = $twitter->loadUserFollowers('matthew101HS');
    foreach ($results as $result) {
        echo "message: ", $result->text;
        echo "posted at ", $result->created_at;
        echo "posted by ", $result->form_user;
開發者ID:0x27,項目名稱:mrw-code,代碼行數:31,代碼來源:some_examples.php

示例3: twitterAction

 /** Initiate request to create a twitter request token. This can only be
  * done when logged into twitter
  * and also as an admin
  * @access public
  * @return void
  */
 public function twitterAction()
 {
     $twitter = new Twitter();
     $this->redirect($twitter->request());
 }
開發者ID:lesleyauk,項目名稱:findsorguk,代碼行數:11,代碼來源:OauthController.php

示例4: Twitter

<?php

require '../common/globals.php';
require '../common/twitter-php-3.2/src/twitter.class.php';
// Fill in the next 2 variables.
$access_token = '15201275-loypZtq58TRB1qoIIu6fTw6TSEqluGZ1aMKgVJjJe';
$access_token_secret = 'haKjTuzH9N6UPhOBZDKSsu6FAZzIvLNbwGhi5wfy00Y';
$twitter = new Twitter(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $access_token, $access_token_secret);
try {
    $friendshipRequests = $twitter->request('friendships/incoming', 'GET');
    echo $friendshipRequests;
    foreach ($friendshipRequests as $request) {
        echo "message: ", $request->ids;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error getting statuses from Twitter: ", $e->getMessage();
}
?>

開發者ID:0x27,項目名稱:mrw-code,代碼行數:19,代碼來源:getfollowrequests.php

示例5: twitter

 public function twitter()
 {
     $auth_url = Twitter::request();
     header('Location: ' . $auth_url);
 }
開發者ID:naveengamage,項目名稱:okaydrive,代碼行數:5,代碼來源:UserController.php

示例6: Twitter

<?php

require_once '../src/twitter.class.php';
// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
// See https://dev.twitter.com/docs/api/1.1
$statuses = $twitter->request('statuses/retweets_of_me', 'GET');
?>
<!doctype html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Twitter retweets of me</title>

<ul>
<?php 
foreach ($statuses as $status) {
    ?>
	<li><a href="http://twitter.com/<?php 
    echo $status->user->screen_name;
    ?>
"><img src="<?php 
    echo htmlspecialchars($status->user->profile_image_url);
    ?>
">
		<?php 
    echo htmlspecialchars($status->user->name);
    ?>
</a>:
		<?php 
    echo Twitter::clickable($status);
    ?>
		<small>at <?php 
開發者ID:mag9,項目名稱:HyTweet,代碼行數:31,代碼來源:custom-request.php

示例7: Twitter

<?php

require '../common/globals.php';
require '../common/twitter-php-3.2/src/twitter.class.php';
// Fill in the next 2 variables.
$access_token = '15201275-loypZtq58TRB1qoIIu6fTw6TSEqluGZ1aMKgVJjJe';
$access_token_secret = 'haKjTuzH9N6UPhOBZDKSsu6FAZzIvLNbwGhi5wfy00Y';
$twitter = new Twitter(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $access_token, $access_token_secret);
$message = $_GET['message'];
try {
    $twitter->request('direct_messages/new', 'POST', array('screen_name' => 'matthew101', 'text' => $message));
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error posting DM to Twitter: ", $e->getMessage();
}
?>

開發者ID:0x27,項目名稱:mrw-code,代碼行數:16,代碼來源:dm.php


注:本文中的Twitter::request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。