php - Post to multiple accounts on twitter using API. getting duplicate status error. -


trying post twitter using laravel and twitter api package. im using foreach loop grab each of account tokens , post keep getting error duplicate status because seems not changing tokens before posting twitter. i've tried refresh page , break connection, still getting error.

here foreachloop

foreach ($post['accountstopost'] $accounttopost) {             $uniqueprofile= db::table('profiles')->where('social_media_id', $accountstopost)->first();             $new_token = [                 'oauth_token'        => $uniqueprofile_test->oauth_token,                 'oauth_token_secret' => $uniqueprofile_test->oauth_secret,                 'x_auth_expires'     => $uniqueprofile_test->x_auth_expires,             ];              session::forget('access_token');             session::put('access_token', $new_token);             twitter::posttweet(['status' => $post['post_text'], 'format' => 'json']);             session::flash('flash_message', 'success! post has been sent.');         } 

into foreach loop im passing in 1. social media i.d 2. oauth, secret tokens 3. content post

when track tokens using echo seems getting right tokens not when posting twitter. connection issue? thats not refreshing connection each account?

figured out. else has same problem package. don't use session:: commands in foreach loop. use twitter::reconfig method. not sure why on post session wasn't changing tokens while in foreach loop no matter tried. using reconfig method solved token issues.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -