tags:

views:

43

answers:

2

There's a few tutorials and classes out there but they no longer appear to work since Twitter changed to oAuth.

How do I send a tweet from PHP, in the most basic way possible?

For example, the 'old' way using the MyTwitter class was as follows:

require_once('MyTwitter.class.php');
$twitter =  new MyTwitter('username', 'password');
$message = "API Test.";
$result = $twitter->updateStatus($message);
print_r($result);
+1  A: 

Theres a good walkthrough here of implementing Twitter OAuth, complete with a working demo. If you're already using a framework you probably have other options also such as Zend_Service_Twitter in Zend Framework

seengee
Unfortunately the working demo doesn't work. It's not passing through the oauth token.
bcmcfc
strange - just checked and it works for me
seengee
A: 

The demo didn't work, but the class itself did-

    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
    $content = $connection->get('account/verify_credentials');
    $result = $connection->post('statuses/update', array('status' => $message));
bcmcfc