Pregunta

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 ?

¿Fue útil?

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top