当前位置: 首页>>代码示例>>PHP>>正文


PHP TwitterOAuth::url方法代码示例

本文整理汇总了PHP中TwitterOAuth::url方法的典型用法代码示例。如果您正苦于以下问题:PHP TwitterOAuth::url方法的具体用法?PHP TwitterOAuth::url怎么用?PHP TwitterOAuth::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TwitterOAuth的用法示例。


在下文中一共展示了TwitterOAuth::url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CheckTWLogin

 public function CheckTWLogin()
 {
     $user = false;
     require_once ROOTPATH . "data/third_party/twitteroauth/src/TwitterOAuth.php";
     $ckey = 'K9SC8vPbbj1V86cUcSl93m2kA';
     $csecret = 'RHfA9S74g9yHPydM4DURpNZyvVm7RU0s7Ci2O070FFG5oAyBC7';
     $access_token = '279588839-8TjR5fwRhuyNySAxUZb6NZIo9w1ymTL1EJJwJE81';
     $access_token_secret = '3LOuzmGKm6HulMjWEfTYLjM20FokhJQeYD8BPJQhfcfYH';
     if ($this->input->get('oauth_token') && $this->input->get('oauth_verifier')) {
         $request_token = array();
         $request_token['oauth_token'] = $this->session->userdata('oauth_token');
         $request_token['oauth_token_secret'] = $this->session->userdata('oauth_token_secret');
         if (!$request_token['oauth_token'] || !$request_token['oauth_token_secret'] || $request_token['oauth_token'] !== $this->input->get('oauth_token')) {
             return false;
         }
         $connection = new TwitterOAuth($ckey, $csecret, $request_token['oauth_token'], $request_token['oauth_token_secret']);
         $access_token = false;
         try {
             $access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $this->input->get('oauth_verifier')));
         } catch (Exception $e) {
         }
         if (!$access_token) {
             return false;
         }
         $connection = new TwitterOAuth($ckey, $csecret, $access_token['oauth_token'], $access_token['oauth_token_secret']);
         $user = $connection->get("account/verify_credentials", array("include_email" => 'true'));
         return $user;
     }
     $connection = new TwitterOAuth($ckey, $csecret, $access_token, $access_token_secret);
     $request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => base_url() . 'informados/user/twitter'));
     $url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
     $this->session->set_userdata('oauth_token', $request_token['oauth_token']);
     $this->session->set_userdata('oauth_token_secret', $request_token['oauth_token_secret']);
     redirect($url);
     return false;
 }
开发者ID:INFOnews,项目名称:infonews,代码行数:36,代码来源:usermodel.php

示例2: TwitterOAuth

<?php

session_start();
require_once 'common.php';
// TwitterOAuth をインスタンス化
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
// コールバックURLをここでセット
$token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
// callback.phpで使うのでセッションに保存
$_SESSION = array('oauth_token' => $token['oauth_token'], 'oauth_token_secret' => $token['oauth_token_secret']);
// Twitter.comの認証画面のURLを取得
$url = $connection->url('oauth/authenticate', array('oauth_token' => $token['oauth_token']));
// 認証画面へリダイレクト
header('location: ' . $url);
开发者ID:OsamuKubomoto,项目名称:test-twitter,代码行数:14,代码来源:login.php

示例3: TwitterAccess

 public function TwitterAccess()
 {
     require_once ROOTPATH . "data/third_party/twitteroauth/src/TwitterOAuth.php";
     if ($this->input->get('oauth_token') && $this->input->get('oauth_verifier')) {
         $request_token = array();
         $request_token['oauth_token'] = $this->session->userdata('oauth_token');
         $request_token['oauth_token_secret'] = $this->session->userdata('oauth_token_secret');
         if (!$request_token['oauth_token'] || !$request_token['oauth_token_secret'] || $request_token['oauth_token'] !== $this->input->get('oauth_token')) {
             $this->result = $this->type . "oauth_token inválido";
             return false;
         }
         $connection = new TwitterOAuth($this->twitter_config['ckey'], $this->twitter_config['csecret'], $request_token['oauth_token'], $request_token['oauth_token_secret']);
         $access_token = false;
         try {
             $access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $this->input->get('oauth_verifier')));
         } catch (Exception $e) {
         }
         if (!$access_token) {
             $this->result = $this->type . "access_token inválido";
             return false;
         }
         $this->TwitterData($access_token);
         return true;
     }
     $connection = new TwitterOAuth($this->twitter_config['ckey'], $this->twitter_config['csecret'], $this->twitter_config['access_token'], $this->twitter_config['access_token_secret']);
     $request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => base_url() . 'apps/social/add/twitter'));
     $url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
     $this->session->set_userdata('oauth_token', $request_token['oauth_token']);
     $this->session->set_userdata('oauth_token_secret', $request_token['oauth_token_secret']);
     redirect($url);
     return false;
 }
开发者ID:INFOnews,项目名称:infonews,代码行数:32,代码来源:socialmodel.php


注:本文中的TwitterOAuth::url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。