Php code to tweet on twitter from website?


#1

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.

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

require_once('twitteroauth.php');
// 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"));

?>

</code

#2

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


#3

Please help me…

How to tweet message with image for twitter using php.

Thanks In Advanced.


#4

test


#5

Please check
http://www.a2zwebhelp.com/show-twitter-feeds


#6

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']); } ?>

#7

Where can I download the 3 required php files?


#8

Hi,

Did you managed to get it to work?

Thanks


#9

#10