Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
身份验证后自动在Twitter上发布:获取无效访问令牌错误_Twitter_Twitter Oauth - Fatal编程技术网

身份验证后自动在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

在这里,我需要在验证后自动在Twitter上发布

我的代码

<?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/";