2014-06-16 2 views
0

내 웹 페이지에 Twitter 사용자 시간대를 통합하고 싶습니다. 그 다음 lib 디렉토리를 사용하고 있습니다. TwitterAPIExchange.php (https://github.com/J7mbo/twitter-api-php)Twitter Api 1.1 응답을 { "오류": [{ "메시지": "인증 할 수 없습니다", "코드": 32}]}

index.php 파일에 필요한 모든 키를 올바르게 제공했습니다.

나는 Index.php를 실행하려고 할 때마다 { "오류"를받습니다 : [{ "메시지": "당신을 인증 할 수 없습니다", "코드": 32}]} 오류와 나는 알아낼 수 없습니다 그것을 해결하는 방법.

get 메소드를 사용하여 데이터를 가져옵니다. 내가 코드에서 뭔가 잘못을보고 있지 않다

ini_set('display_errors', 1); 
require_once('TwitterAPIExchange.php'); 

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/ 
$settings = array(
'oauth_access_token' => "xxxxxxxxxxxxxx", 
'oauth_access_token_secret' => "xxxxxxxxxxxxxxxxxxxx", 
'consumer_key' => "xxxxxxxxxxxxxx", 
'consumer_secret' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
); 


/** Perform a GET request and echo the response **/ 
/** Note: Set the GET field BEFORE calling buildOauth(); **/ 
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; 
$getfield = '?screen_name=fresherworld'; 
$requestMethod = 'GET'; 
$twitter = new TwitterAPIExchange($settings); 
echo $twitter->setGetfield($getfield) 
     ->buildOauth($url, $requestMethod) 
     ->performRequest(); 

답변

0

: 여기

는 index.php에 코드입니다. 그러나 어떤 것을 확인하려고 노력하십시오. 1) 지저귐 앱 권한을 확인하고 읽고 쓰도록 설정하십시오. 2) 소비자 키/비밀번호를 다시 생성 해보세요. 3) 사용자가 앱을 승인 했습니까? 앱을 승인 한 사용자 세부 정보 만 볼 수 있습니다. 4) 최신 lib를 사용하십시오.