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


PHP TwitterOAuth::oAuthRequest方法代碼示例

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


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

示例1: testIDsList

 function testIDsList()
 {
     global $THINKTANK_CFG;
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/followers/ids.xml', array(), 'GET');
     $r = array();
     $r["id"] = 0;
     $r['network_username'] = 'user';
     $r['network_user_id'] = 0;
     $r['last_status_id'] = 0;
     $r['last_page_fetched_replies'] = 0;
     $r['last_page_fetched_tweets'] = 0;
     $r['total_posts_in_system'] = 0;
     $r['total_replies_in_system'] = 0;
     $r['total_follows_in_system'] = 0;
     $r['total_users_in_system'] = 0;
     $r['is_archive_loaded_replies'] = 0;
     $r['is_archive_loaded_follows'] = 0;
     $r['crawler_last_run'] = '1/1/2007';
     $r['earliest_reply_in_system'] = 0;
     $r['api_calls_to_leave_unmade_per_minute'] = 5;
     $r['avg_replies_per_day'] = 0;
     $r['is_public'] = 1;
     $r['is_active'] = 1;
     $r['network'] = 'twitter';
     $i = new Instance($r);
     $api = new CrawlerTwitterAPIAccessorOAuth('111', '222', $THINKTANK_CFG['oauth_consumer_key'], $THINKTANK_CFG['oauth_consumer_secret'], $i, $THINKTANK_CFG['archive_limit']);
     $users = $api->parseXML($result);
     $next_cursor = $api->getNextCursor();
     //echo 'Next cursor is ' . $next_cursor;
     $this->assertTrue($next_cursor == '1326272872342936860');
 }
開發者ID:ukd1,項目名稱:thinktank,代碼行數:32,代碼來源:twitterapiaccessoroauth_test.php

示例2: testIDsList

 public function testIDsList()
 {
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/followers/ids.xml', 'GET', array());
     $api = new CrawlerTwitterAPIAccessorOAuth('111', '222', 1234, 1234, 5, 3200, 5, 350);
     $users = $api->parseXML($result);
     $next_cursor = $api->getNextCursor();
     $this->assertTrue($next_cursor == '1326272872342936860');
 }
開發者ID:ravi-modria,項目名稱:ThinkUp,代碼行數:9,代碼來源:TestOfTwitterAPIAccessorOAuth.php

示例3: testIDsList

 function testIDsList()
 {
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/followers/ids.xml', array(), 'GET');
     $api = new CrawlerTwitterAPIAccessorOAuth('111', '222', $THINKTANK_CFG['oauth_consumer_key'], $THINKTANK_CFG['oauth_consumer_secret'], $i, $THINKTANK_CFG['archive_limit']);
     $users = $api->parseXML($result);
     $next_cursor = $api->getNextCursor();
     //echo 'Next cursor is ' . $next_cursor;
     $this->assertTrue($next_cursor == '1326272872342936860');
 }
開發者ID:nickthornley,項目名稱:thinktank,代碼行數:10,代碼來源:friends_paging_test.php

示例4: testIDsList

 public function testIDsList()
 {
     global $THINKUP_CFG;
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/followers/ids.xml', 'GET', array());
     $api = new CrawlerTwitterAPIAccessorOAuth('111', '222', 1234, 1234, $this->getTestInstance(), 3200);
     $users = $api->parseXML($result);
     $next_cursor = $api->getNextCursor();
     //echo 'Next cursor is ' . $next_cursor;
     $this->assertTrue($next_cursor == '1326272872342936860');
 }
開發者ID:rayyan,項目名稱:ThinkUp,代碼行數:11,代碼來源:TestOfTwitterAPIAccessorOAuth.php

示例5: httpRequest

 /**
  * Process HTTP request.
  * @param  string  URL
  * @param  array   POST data
  * @return mixed
  * @throws TwitterException
  */
 private function httpRequest($url, $postData = NULL)
 {
     if (!$this->oauth instanceof TwitterOAuth) {
         throw new TwitterException('Not authorized.');
     }
     $result = $this->oauth->oAuthRequest($url, $postData ? 'POST' : 'GET', $postData);
     if (strpos($url, 'json')) {
         $payload = @json_decode($result);
         // intentionally @
     } else {
         $payload = @simplexml_load_string($result);
         // intentionally @
     }
     if (empty($payload)) {
         throw new TwitterException('Invalid server response');
     }
     return $payload;
 }
開發者ID:jkrcma,項目名稱:twitter-php,代碼行數:25,代碼來源:twitter.class.php

示例6: executeTwitterPost

 public function executeTwitterPost(sfWebRequest $request)
 {
     $activityId = $request->getParameter('id');
     $activity = Doctrine::getTable('ActivityData')->findOneById($activityId);
     $user = $this->getUser();
     $state = $user->getAttribute('twitter_oauth_state', 0);
     if (2 !== $state) {
         $this->forward('twitter', 'login');
     }
     try {
         $consumerKey = sfConfig::get('app_twitter_consumer_key');
         $consumerSecret = sfConfig::get('app_twitter_consumer_secret');
         $token = $user->getAttribute('twitter_oauth_token');
         $secret = $user->getAttribute('twitter_oauth_secret');
         $oauth = new TwitterOAuth($consumerKey, $consumerSecret, $token, $secret);
         $oauth->oAuthRequest('statuses/update', 'POST', array('status' => $activity->body));
         $this->redirect('@homepage');
     } catch (OAuthException $e) {
         $user->setAttribute('twitter_oauth_state', 0);
         throw $e;
         //$this->forward('twitter', 'login');
     }
 }
開發者ID:upsilon,項目名稱:opTwitterlikePlugin,代碼行數:23,代碼來源:opTwitterlikePluginActions.class.php

示例7: testMakingAPICall

 function testMakingAPICall()
 {
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/users/show/anildash.xml', array(), 'GET');
     $this->assertWantedPattern('/Anil Dash/', $result);
 }
開發者ID:karbassi,項目名稱:twitalytic,代碼行數:6,代碼來源:twitteroauth_test.php

示例8: twitter_post_answer

/**
 * Handles posting answer to twitter. APP requires write permission.
 *
 * @param int $commentID
 * @return mixed
 */
function twitter_post_answer($commentID)
{
    global $up_options;
    if (isset($_SESSION['twitter_accesstoken']) && isset($_SESSION['twitter_accesstokensecret'])) {
        $comment_text = strip_tags(get_comment_text($commentID));
        if (strlen($comment_text) > 70) {
            $comment_text = substr($comment_text, 0, 70) . "...";
        }
        $comment_text = get_comment_link($commentID) . " : " . $comment_text;
        $comment_text = urldecode($comment_text);
        $twitter_consumer_key = $up_options->twitter_consumer_key;
        //get_option("qya_textTwitterConsumerKey");
        $twitter_consumer_secret = $up_options->twitter_consumer_secret;
        //get_option("qya_textTwitterConsumerSecret");
        $connection = new TwitterOAuth($twitter_consumer_key, $twitter_consumer_secret, $_SESSION['twitter_accesstoken'], $_SESSION['twitter_accesstokensecret']);
        return $connection->oAuthRequest("http://api.twitter.com/1/statuses/update.xml", "POST", array("status" => $comment_text));
    }
}
開發者ID:gp6shc,項目名稱:aok,代碼行數:24,代碼來源:twitter-new.php

示例9: TwitterOAuth

 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, TWITTER_OAUTH_TOKEN, TWITTER_OAUTH_TOKEN_SECRET);
 $searchUrl = $connection->host . "search/tweets." . $connection->format;
 $sqlinstw1 = "SELECT * FROM tbl_keywords";
 $resultinstw1 = mysql_query($sqlinstw1) or die(mysql_error());
 while ($row = mysql_fetch_array($resultinstw1)) {
     $idinstw1 = $row['id'];
     $keywordNameinstw1 = $row['name'];
     $searchkw = str_replace(" ", "+", $keywordNameinstw1);
     $sql11instw1 = "SELECT * FROM tbl_twitter_data where project_id = '" . $idinstw1 . "'";
     $result11instw1 = mysql_query($sql11instw1) or die(mysql_error());
     $count11instw1 = mysql_num_rows($result11instw1);
     $i = 0;
     if ($count11instw1 > 0) {
         $sql18instw1 = "DELETE FROM tbl_twitter_data where project_id = '" . $idinstw1 . "'";
         $result18instw1 = mysql_query($sql18instw1) or die(mysql_error());
         $searchResponse = $connection->oAuthRequest($searchUrl, "GET", array('q' => $searchkw, 'count' => TWITTER_COUNT_SIZE));
         $searchResponse = json_decode($searchResponse);
         foreach ($searchResponse as $searches) {
             foreach ($searches as $search) {
                 if (is_object($search)) {
                     $i++;
                     $name = $search->user->name;
                     $screenName = $search->user->screen_name;
                     $tweet = $search->text;
                     $tweetDate = date('Y-m-d H:i:s', strtotime($search->created_at));
                     $insArrTw[] = "(\t\t\t\t\t\t\t'" . $idinstw1 . "',\n                                                                '" . $screenName . "',\n                                                                '" . remove_spacial_1(remove_spacial(clean_insert($name))) . "',\n                                                                '" . remove_spacial_1(remove_spacial(clean_insert($tweet))) . "',\n                                                                '" . $tweetDate . "')";
                 }
             }
         }
         //$sql23insta1 = "insert into tbl_twitter_data(keywordId,screenName,name,tweet,tweetDate) values" . implode(',', $insArrTw);
         //mysql_query($sql23insta1) or die(mysql_error() . "==========>sql23insta1");
開發者ID:asimkcybyte,項目名稱:Cybyte-SpotCrowdProject-Closing,代碼行數:31,代碼來源:allcommon_cron_1.php


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