mardi 2 août 2016

How to handle duplicate status post in twitter using api

I am new to using the twitter api. I am using the thujohn/twitter package with my larval 5 project and have managed to get most things, like login, and posting to twitter from my site working.

My problem is , how do I handle duplicate tweets. Twitter doesn't allow it. so everytime someone post a duplicate i get this error page:

Exception in Twitter.php line 297: [187] Status is a duplicate.

I would like if the tweet is a duplicate for it just to redirect to my home page, but the code gets killed once it reads it as a duplicate. I was wondering if there was a way to check if duplicate of even another clever way to handle this.

the code I'm using to test is in my route as follows:

Route::get('/twitter/post/status', function()
 {
   Twitter::postTweet(['status' => 'Just coding as usuall', 'format' =>     'json']);
   return redirect()->route('home');
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire