Closed nkkiran008 closed 13 years ago
You should try this
https://github.com/abraham/twitteroauth/blob/master/redirect.php
<?php
$YourURL= 'http://elitevb.net/landingpage.php';
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
/* Get temporary credentials. */
$request_token = $connection->getRequestToken(OAUTH_CALLBACK);
/* If last connection failed don't display authorization link. */
switch ($connection->http_code) {
case 200:
/* Build authorize URL and redirect user to Twitter. */
$url = $connection->getAuthorizeURL($token);
header('Location: ' . $YourURL);
break;
default:
/* Show notification if something went wrong. */
echo 'Could not connect to Twitter. Refresh the page or try again later.';
}
Thanks ! for your suggestion,i have got implemented, but client is not accepting second time redirecting to twitter for authentication. Can you please explain what could be the reason to redirect second time,is there any way to get authentication in single time.
sorry to my bad english
If you want to authenticate ever time then destroy the session/cookies and have them login. if you want to keep them authenticated while they are using you website you need to use cookies or sessions to save there authentication on there web browser or in a database.
https://github.com/abraham/twitteroauth/blob/master/clearsessions.php
^^ thats the way you logout/ clear sessions.
Im getting token details by calling as $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters); here $request getting data successfully when using mozilla 3.6 and redirecting to my home page,when use mozilla 4.0 or chromo $request not getting data showing as empty array.
sorry for my dirty English, please help me.