How to send a tweet from PHP with OAuth?
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);
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));
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
精彩评论