Php code to tweet on twitter from website?


I have tried to tweet from my website to my tweeter account using php.
I have used following code but did not found tweet on my twitter account. Please check.

$consumerKey = 'XXXX';
$consumerSecret = 'XXX';
$OAuthToken = '515353914-ghNtHt6H0wzzU2r73RfKpXvZFD66ddbesMedJMUF';
$OAuthSecret = 'nb6cUaZZBSIU3TwvimnadT4OF2UV4aU8Vm6ExHvTI';

// create new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);

// Your Message
$message = "This is a test message.";

// Send tweet 
$tweet->post('statuses/update', array('status' => "$message"));




This is cool!
At this time , I wont have $OAuthToken & $OAuthSecret.
I have only username & password, then what should i do ?
please guide me


Please help me…

How to tweet message with image for twitter using php.

Thanks In Advanced.




Please check


Check this is working live code.

<?php require 'tmhOAuth.php'; require 'config.php'; require 'tmhUtilities.php'; $tmhOAuth = new tmhOAuth(array( 'consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'user_token' => $user_token, 'user_secret' => $user_secret, )); $message = "Nkonnect is now sensing Future."; $code = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array( 'status' => $message )); if ($code == 200) { tmhUtilities::pr(json_decode($tmhOAuth->response['response'])); } else { tmhUtilities::pr($tmhOAuth->response['response']); } ?>


Where can I download the 3 required php files?



Did you managed to get it to work?