How to post tweets to multiple users accounts in laravel?

Im using this package https://github.com/thujohn/twitter to authorize users. I am able to authorize multiple users and get their data from twitter. I am struggling to post tweets to multiple users twitter accounts. Everytime I try to post it will only tweet to 1 users account. How can I post to multiple users accounts after authorization?

Here is the code I have tried. I save the user's tokens in the database and then grab it and put it in the session. :

Route::get('tweet', function(){
        $token = Input::get( 'oauth_token' );
        $verify = Input::get( 'oauth_verifier' );
        $screen_name = DB::table('profiles')->where('oauth_token', $token)->pluck('screen_name');
        $tweet_text = Input::get('tweet_text');

        Session::put('oauth_request_token', $token);
        Session::put('oauth_request_token_secret', $verify);
        Session::get('oauth_request_token');
        Session::get('oauth_request_token_secret');


        dd( Twitter::postTweet(['status' => $tweet_text, 'format' => 'json']) );

});

Answers


I figured out what I was doing wrong incase anyone else runs into this problem. You have two pairs of tokens. The package I used calls them both oauth_token and oauth_token_secret but in two different arrays. I used the wrong pair and so It would only post to the last authenticated account. Make sure you use access_token pair and store them for later use. Which you can then use to post to the right/multiple accounts.


Need Your Help

(Hadoop) MapReduce - Chain jobs - JobControl doesn't stop

hadoop mapreduce chain job-control

I need to chain two MapReduce jobs. I used JobControl to set job2 as dependent of job1.

Best way to pass JSON from PHP controller to AngularJS controller?

javascript php json angularjs

I am working with Angular JS and Yii2. In one of my PHP controllers I need to pass an array of data from backend to front end, so I am json encoding my php array and setting a var in the view like ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.