
Description
I see this has been raised before but as far as I can see it's till an issue...
my code is basically cut and paste from git example:
oauth_requestToken(array( 'oauth_callback' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] )); ``` // stores it $cb->setToken($reply->oauth_token, $reply->oauth_token_secret); $_SESSION['oauth_token'] = $reply->oauth_token; $_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; // gets the authorize screen URL $auth_url = $cb->oauth_authorize(); header('Location: ' . $auth_url); die(); ``` } else { // gets the access token $cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $reply = $cb->oauth_accessToken(array( 'oauth_verifier' => $_GET['oauth_verifier'] )); // store the authenticated token, which may be different from the request token (!) $_SESSION['oauth_token'] = $reply->oauth_token; $_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; } $reply = (array) $cb->statuses_homeTimeline(); ``` print_r($reply); echo ''; ``` //Tweeting is as easy as this: $reply = $cb->statuses_update('status=Whohoo, I just tweeted!'); ``` print_r($reply); echo '
'; ``` //When uploading files to Twitter, the array syntax is obligatory: $params = array( 'status' => 'test @dm_dev_test1 #test', 'media[]' => 'test.jpg' ); $reply = $cb->statuses_updateWithMedia($params); ``` print_r($reply); echo '
'; ``` ?>
if I open page in browser i get the twitter authorise window and then:
Array ( [errors] => Array ( [0] => stdClass Object ( [message] => Invalid or expired token [code] => 89 ) ) [httpstatus] => 401 )
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Invalid or expired token [code] => 89 ) ) [httpstatus] => 401 )
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Invalid or expired token [code] => 89 ) ) [httpstatus] => 401 )
if I immediately reload page the tweets are correctly submitted to twitter and i can see them in my twitter feed.
if I reload the page one more time i get:
Array ( [errors] => Array ( [0] => stdClass Object ( [message] => Bad Authentication data [code] => 215 ) ) [httpstatus] => 400 )
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Bad Authentication data [code] => 215 ) ) [httpstatus] => 400 )
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Bad Authentication data [code] => 215 ) ) [httpstatus] => 400 )
any ideas what's going wrong here?
many thanks.