Hi Guy’s I need to write a php application that allows a single user (me) to POST to twitter. I have tried numerous tutorials, but end up getting error messages . Could you share some simple php code that will allow me to POST to twitter by using Access tokens. Thanks
See [node:124]. Make sure you have created read and write access tokens.
Thanks, I have tried @abraham’s PHP twitteroauth Library, but I seem to get the same errors over and over:
Notice: Undefined index: oauth_token in C:\wamp\www\test\twitteroauth\twitteroauth.php on line 82
Notice: Undefined index: oauth_token_secret in C:\wamp\www\test\twitteroauth\twitteroauth.php on line 82
Notice: Undefined index: oauth_token in C:\wamp\www\test\redirect.php on line 15
Notice: Undefined index: oauth_token_secret in C:\wamp\www\test\redirect.php on line 16
Ps I have modified the config.php file.
Thanks in advance
I’m not familiar with working with this library in Windows environments. It’s likely a configuration issue of some kind, or you’re executing code that’s not relevant to what you’re trying to accomplish (or have entered keys in to accomplish).
This error means that Twitter isn’t returning a request_token. If you are hardcoding an access token from a single user then you shouldn’t be using this method anyways.
This is all you need to post a status to Twitter from a single account. You should also add some error handling.<?php require_once('twitteroauth/twitteroauth.php');
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(‘CONSUMER_KEY’, ‘CONSUMER_SECRET’, ‘ACCESS_TOKEN’, ‘ACCESS_TOKEN_SECRET’);
$connection->post(‘statuses/update’, array(‘status’ => ‘text to tweet’));
Thank You Very Much … It works !
pelase help me, i same problem