1
當試圖簡單地得到提及對正確驗證我得到以下JSON一筆賬:亞伯拉罕的twitteroauth的PHP庫中提到的回頭率不良網址
"mentions": {
"errors": [
{
"message": "Sorry, that page does not exist",
"code": 34
}
]
},
,我使用登錄併產生這種情況的代碼如下:
private function get_twitter($json) {
$_SESSION['access_token']['oauth_token'] = ACCESS_TOKEN;
$_SESSION['access_token']['oauth_token_secret'] = ACCESS_TOKEN_SECRET;
/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
/* Load and clear sessions */
session_start();
session_destroy();
if (CONSUMER_KEY === '' || CONSUMER_SECRET === '' || CONSUMER_KEY === 'CONSUMER_KEY_HERE' || CONSUMER_SECRET === 'CONSUMER_SECRET_HERE') {
$json['twitter_login_prompt'] = 'You need a consumer key and secret. Get one from <a href="https://dev.twitter.com/apps">dev.twitter.com/apps</a>';
exit;
}
/* Build an image link to start the redirect process. */
$json['twitter_login'] = '<a href="./redirect.php"><img src="./images/lighter.png" alt="Sign in with Twitter"/></a>';
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
/* If method is set change API call made. Test is called by default. */
$json['twitter_verify'] = $connection->get('account/verify_credentials');
$json['mentions'] = $connection->get('/1/statuses/mentions');
return $json;
}
非常感謝,我想通了這一點事後。 由於某種原因,我無法使用部分網址。只有完全合格的網址。 – bwavoplz
不客氣@bwavoplz!你會如此善良接受我的回答嗎? –