本文整理汇总了PHP中tmhOAuth::php_self方法的典型用法代码示例。如果您正苦于以下问题:PHP tmhOAuth::php_self方法的具体用法?PHP tmhOAuth::php_self怎么用?PHP tmhOAuth::php_self使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmhOAuth
的用法示例。
在下文中一共展示了tmhOAuth::php_self方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tmhOAuth
*
* Instructions:
* 1) If you don't have one already, create a Twitter application on
* http://dev.twitter.com/apps
* 2) From the application details page copy the consumer key and consumer
* secret into the place in this code marked with (YOUR_CONSUMER_KEY
* and YOUR_CONSUMER_SECRET)
* 3) Fill in the username and password of the user you wish to obtain
* the user token and secret for.
* 4) Visit this page using your web browser.
*
* @author themattharris
*/
require '../tmhOAuth.php';
$tmhOAuth = new tmhOAuth(array('consumer_key' => '9iERUaqhjAUG2kHKLGPZ8g', 'consumer_secret' => 'h7k1zcHCwGMHD7UeF1vQmETpog9ce2bneNsyM3q60Ko'));
$here = $tmhOAuth->php_self();
session_start();
// reset?
if (isset($_REQUEST['wipe'])) {
session_destroy();
header("Location: {$here}");
// already got some credentials stored?
} elseif (isset($_SESSION['access_token'])) {
$tmhOAuth->config['user_token'] = $_SESSION['access_token']['oauth_token'];
$tmhOAuth->config['user_secret'] = $_SESSION['access_token']['oauth_token_secret'];
$tmhOAuth->request('GET', $tmhOAuth->url('1/account/verify_credentials'));
$tmhOAuth->pr(json_decode($tmhOAuth->response['response']));
// we're being called back by Twitter
} elseif (isset($_REQUEST['oauth_verifier'])) {
$tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
$tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];