I am updating my Twitter status wthout problems in localhost using Xammp, but The same code is not working online. Am I missing any protocol or something else?
require(‘twitteroauth.php’);
define(’_CONSUMER_KEY’,‘key’); // consumer key
define(’_CONSUMER_SECRET’,‘secret’); // consumer secret
define(’_OAUTH_TOKEN’,‘token’); // access token
define(’_OAUTH_TOKEN_SECRET’,‘token secret’); // access token secret
function getConnectionWithAccessToken() {
$connection = new TwitterOAuth(_CONSUMER_KEY, _CONSUMER_SECRET,_OAUTH_TOKEN, _OAUTH_TOKEN_SECRET);
return $connection;
}
// connection
$connection = getConnectionWithAccessToken();
//Publish the message
$msg = “message Twitterusing OAuth.”;
$twitter= $connection->post(‘statuses/update’, array(‘status’ => $msg) );
echo $msg ;