Im using abrahams oauth twitter library. but Im having some difficulty posting to twitter from php on my site.
I am receiving zero errors, but nothing is happening. Has anyone been able to solve this very simple issue? Can you share you knowledge?
Thx
/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('twitteroauth/config.php');
$connection = new TwitterOAuth ('myprivatecode', myprivatecode', 'myprivatecode','myprivatecode');
$content = $connection->get('account/verify_credentials');
$connection->post('statuses/update', array('status' => $myTweet));
Try this,
<?PHP
require_once 'twitteroauth.php';
define("CONSUMER_KEY", "....");
define("CONSUMER_SECRET", "...");
define("OAUTH_TOKEN", "...");
define("OAUTH_SECRET", "...");
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get('account/verify_credentials');
$connection->post('statuses/update', array('status' => 'test'));
?>
After requesting Read & Write permissions, you have to RECREATE your access tokens to reflect the new permissions.
A working example for Post to twitter using PHP Oauth API
Hope it helps..
" /* Load required lib files. */ session_start();
require_once('twitteroauth/twitteroauth.php'); require_once('twitteroauth/config.php');
$connection = new TwitterOAuth ('myprivatecode', myprivatecode' 'myprivatecode','myprivatecode');
$content = $connection->get('account/verify_credentials'); $connection->post('statuses/update', array('status' => $myTweet)); "
Have you set a variable via a form post or anything for
$mytweet
Without any more information it is hard to tell. I assume the files are correct in the require_once since the file actually processes.
Make sure the form is sent via post, not much else we can help with with so little information.