身份验证后自动在Twitter上发布:获取无效访问令牌错误
在这里,我需要在验证后自动在Twitter上发布 我的代码身份验证后自动在Twitter上发布:获取无效访问令牌错误,twitter,twitter-oauth,Twitter,Twitter Oauth,在这里,我需要在验证后自动在Twitter上发布 我的代码 <?php session_start(); include("twitteroauth.php"); define('CONSUMER_KEY','zubLdCze6Erz9SVNIgG3w'); define('CONSUMER_SECRET','ZnZQ77bNnpBER2aSxTQGEXToAQODz9qEBSAXIdeYw'); define('OAUTH_CALLBACK','http://dev.pubs.pos
<?php
session_start();
include("twitteroauth.php");
define('CONSUMER_KEY','zubLdCze6Erz9SVNIgG3w');
define('CONSUMER_SECRET','ZnZQ77bNnpBER2aSxTQGEXToAQODz9qEBSAXIdeYw');
define('OAUTH_CALLBACK','http://dev.pubs.positive-dedicated.net/Licensee/addPubEventWeekly.php');
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
/* Get temporary credentials. */
$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
/* Save temporary credentials to session. */
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
switch ($connection->http_code) {
case 200:
/* Build authorize URL and redirect user to Twitter. */
$url = $connection->getAuthorizeURL($token);
header('Location: ' . $url);
break;
default:
/* Show notification if something went wrong. */
echo 'Could not connect to Twitter. Refresh the page or try again later.';
}
?>
但这里我得到了“无效/过期访问令牌”错误
我已经将twittreauth.php库文件也从1.0更改为1.1
public $host = "https://api.twitter.com/1.1/";
请建议如何修复此问题
public $host = "https://api.twitter.com/1.1/";