Sunday 15 February 2015

php - Using twitterOAuth for login scripts -


I recently started working with twitteroaath login, which starts working in examples, but when I do not unite the redirection,

Php and callback.php do the work of each other based on the script below (which is the script I'm working on), the other part works fine (which Is based on redirect.php), returns an othe_token and ot_varifier, but the first part (c Looks like it's not even starting at allback.php). This should be done when Twitter redirects the user to the homepage.

Any ideas / suggestions people?

  session_start (); Need_once ('socialCodes.php'); // where I need my app ID and secret ('twitteroauth / twitteroauth.php'); If (isset ($ _GET ['oauth_token'])) $ $ connection = new twitteroff ($ twAppID, $ twAppSec, $ _SESSION ['oauth_token'], $ _SESSION ['oauth_token_secret']); $ Connection-> Host = "https://api.twitter.com/1.1/"; $ Access_token = $ connection- & gt; GetAccessToken ($ _GET ['oauth_verifier']); $ _SESSION ['access_token'] = $ access_token; Not set ($ _ session ['oauth_token']); Not set ($ _ session ['oauth_token_secret']); If ($ 200 == $ connection-> http_code) {$ userAccessToken = $ access_token ['oauth_token']; $ UserSecretToken = $ access_token ['oauth_token_secret']; $ UserID = $ access_token ['user_id']; $ UsernameName = $ access_token ['screen_name']; }} And {$ connection = new TwitterOAuth ($ twAppID, $ twAppSec); $ Connection-> Host = "https://api.twitter.com/1.1/"; $ Request_token = $ connection- & gt; GetRequest token ('myhomepage'); $ _SESSION ['oauth_token'] = $ token = $ request_token ['oauth_token']; $ _SESSION ['oauth_token_secret'] = $ request_token ['oauth_token_secret']; Switch ($ connection-> http_code) {case 200: $ url = $ connection-> GetAuthorizeURL ($ token); Header ('location:'. $ Url); break; Default: Echo 'could not connect to Twitter. Refresh the page or try again later. '; It was a caching problem, and the script now works. / P>  

No comments:

Post a Comment