Ive been working with the twitter oauth and api and im having a weird issue.
What im doing is generating a request link, saving the request token and secret in a session variable, then when the user comes back from twitter, trying to retrieve those keys to store them in the database.
When i execute the following:
session_start();
$to = new TwitterOAuth($consumerkey, $consumersecret);
$tok = $to->getRequestToken();
$request_link = $to->getAuthorizeURL($tok);
$_SESSION["oauth_request_token"] = $token = $tok['oauth_token'];
$_SESSION["oauth_request_token_secret"] = $tok['oauth_token_secret'];
print_r($_SESSION)."<br>";
It displays that the session array contains my values and they are correct, however when it comes back from twitter, print_r'ing the session array produces nothing, same for echo. Its like its not there or something.
I am starting the session on both pages at the top first line.
The second page reads:
session_start();
echo $_SESSION["oauth_request_token"];
echo $_SESSION["oauth_request_token_secret"];
Weird thing is that if i manually declare the session variable on the second page, it works fine. Am i missing something?