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


PHP OAuthRequest::redirect方法代码示例

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


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

示例1: TPSession

<?php

include_once "oauth-php-98/library/OAuthStore.php";
include_once "oauth-php-98/library/OAuthRequester.php";
include_once 'config.php';
// Create a new session object.  It will flush any local cookies that you have in case
// you hit this page in error, since this should be the "Login" page.
$user_session = new TPSession();
// Obtain a Request token from TypePad.
$user_session->request_and_verify_request_token();
// Next step in the OAuth Dance: Redirect your user to the Provider.
// this redirect() method is courtesy of our OAuthPHP lib. Parameters:
//   1 = the URL to redirect to
//   2 = a list of parameters. In our case, it's the Request token.
/*
    * 'oauth-authorization-page' is deprecated in favor of 'oauthAuthorizationUrl'.    
 OAuthRequest::redirect($user_session->get_api_endpoint('oauth-authorization-page'), 
                     array('oauth_token' => $user_session->oauth_token));
*/
OAuthRequest::redirect($user_session->get_api_endpoint(TP_OAUTH_AUTH_URL), array('oauth_token' => $user_session->oauth_token));
// FYI: HTML is forbidden in this file, since the redirect's headers cannot be written!!
?>
   
开发者ID:nataliepo,项目名称:Claire,代码行数:22,代码来源:login.php

示例2: fopen

      oauth_signature=n3lQROBcPnBZvEgplUzHcgkUCrA%3D &
      oauth_timestamp=1269811986 &
      oauth_callback=http%3A%2F%2F127.0.0.1%3A5000%2Flogin-callback &
      oauth_nonce=853433351 &
      oauth_consumer_key=c5139cef2985b86d &
      oauth_version=1.0 &
      oauth_signature_method=HMAC-SHA1
   */
$handle = fopen($final_url, "rb");
$doc = stream_get_contents($handle);
$response_array = explode("&", $doc);
// Store the results!  Anything but 200 will croak to the browser for now.
$response = array();
foreach ($response_array as $response_str) {
    $pair = explode("=", $response_str);
    $response[$pair[0]] = $pair[1];
}
// Instead of storing the Request token as a cookie, write it to the db.
$store->addServerToken(CONSUMER_KEY, 'request', $response['oauth_token'], $response['oauth_token_secret'], $user_id, '');
var_dump($oauth);
debug("After creating a simple request token, store obj = ^ ");
/*
   Next step in the OAuth Dance: Redirect your user to the Provider.
*/
$query_params = array();
$query_params['oauth_token'] = $response['oauth_token'];
// the redirect() method is from the OAuth library
OAuthRequest::redirect($endpoint_strs['oauth-authorization-page'], $query_params);
// HTML is forbidden in this file, since the redirect's headers cannot be written!!
?>
   
开发者ID:nataliepo,项目名称:Claire,代码行数:30,代码来源:login.php


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