I got it working using these files http://runnable.com/UnUq8RFIGS9NAAA0/twitter-update-status-for-php-twitteroauth-and-oauth
Login to twitter app for multiple users with twitteroauth
-
28-06-2023 - |
Question
Im making an app where users can comment to website. Soo far i came up with.
$sporocilo = $_POST["sporocilotw"];
$sporocilo2 = $sporocilo . " #vetercek";
require_once 'twitteroauth.php';
define('CONSUMER_KEY', 'XXXXXXXXXXXXXXXXXXXXX');
define('CONSUMER_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXx');
define('ACCESS_TOKEN', 'XXXXXXXXXXXXXXXXx-XXXXXXXXXXXXXXXXX');
define('ACCESS_TOKEN_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$toa = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$query = array(
"status" => $sporocilo2,
"display_coordinates" => "false"
);
$results = $toa->post('statuses/update', $query);
What this does is post a tweet. The problem is that the user who sends it is always the same (app). How could i make login page or something similar so users would post tweets with their own names ?
Solution 2
OTHER TIPS
Nope it does not work that way.
The CONSUMER_KEY
, CONSUMER_SECRET
, ACCESS_TOKEN
& ACCESS_TOKEN_SECRET
corresponds to the current account/app. You cannot impersonate it. They are different for each and every account/app.
You can do tweets on your page , on other's walls , retweet only from this account , you can't use other account as you need the above mentioned credentials which will be a different one.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow