I can't tweet via oauth

<?php require_once('twitteroauth.php'); $connection = new TwitterOAuth('*********', '***********','**************','**********'); $connection->post('statuses/update', array('status' => 'text to be tweeted')); ?>

this is my php file, in the same folder i have twitteroaut.php and oauth.php. I uploaded these files to my website but nothing happens when i open it.

<?php /** * post_tweet.php * Example of posting a tweet with OAuth * @author Adam Green <140dev@gmail.com> * @license GNU Public License */

$tweet_text = ‘Hello Twitter’;
print “Posting…\n”;
$result = post_tweet($tweet_text);
print "Response code: " . $result . “\n”;

function post_tweet($tweet_text) {

// Use Matt Harris’ OAuth library to make the connection
// This lives at: https://github.com/themattharris/tmhOAuth

// Set the authorization values
// In keeping with the OAuth tradition of maximum confusion,
// the names of some of these values are different from the Twitter Dev interface
// user_token is called Access Token on the Dev site
// user_secret is called Access Token Secret on the Dev site
// The values here have asterisks to hide the true contents
// You need to use the actual values from your Twitter app
$connection = new tmhOAuth(array(
‘consumer_key’ => ‘******’,
‘consumer_secret’ => ‘******’,
‘user_token’ => ‘******’,
‘user_secret’ => ‘******’,

// Make the API call
array(‘status’ => $tweet_text));

return $connection->response[‘code’];

//Hope it will help you


Hello, I have made the same thing what you have said and i got Posting… Response code: 410 the tweet message is not appearing on my twitter account. Please help me how can i solve the issue.