3
以下は、oauthとoauthの両方の秘密情報を取得するために使用したものです。ユーザーアクセストークンとアクセストークンの秘密はどのように取得できますか?Twitterユーザートークンとアクセストークンの秘密を取得する
私は上記のトークンに事前に
require("twitteroauth/twitteroauth.php");
// The TwitterOAuth instance
$twitteroauth = new TwitterOAuth('YOUR_CONSUMER_KEY', 'YOUR_CONSUMER_SECRET');
// Requesting authentication tokens, the parameter is the URL we will be redirected to
$request_token = $twitteroauth->getRequestToken('localhost.com/…');
// Saving them into the session
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
// If everything goes well..
if($twitteroauth->http_code==200){
// Let's generate the URL and redirect
$url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']); header('Location: '. $url); } else { // It's a bad idea to kill the script, but we've got to know when there's an error.
die('Something wrong happened.');
}
感謝を使用していることを取得するには、ドキュメントに記載されたいずれかの手順を参照してくださいしないでください!
:これは、このコードはやるん上記code.Whatに代わるものですか? –
それは代替ではありません - それは2番目のステップです。あなたのコードはtwitter.comに行くユーザで終わり、twitter.comから戻ってきたユーザで始まります – izeed
私のocdeとあなたのコードを混同することはできますか?あなたのコードと混同しますか?あなたのコードはどこに置くべきですか?$ _COOKIE [ ttok ']。あなたのコードを別のファイルに置くべきか、何が紛らわしいのでしょうか。 –