Skip to content

Instantly share code, notes, and snippets.

@vjnrv
Forked from abraham/annotations.php
Created May 29, 2010 20:42
Show Gist options
  • Save vjnrv/418539 to your computer and use it in GitHub Desktop.
Save vjnrv/418539 to your computer and use it in GitHub Desktop.
<?php
/**
* Get the TwitterOAuth source code:
* http://github.com/abraham/twitteroauth
* git clone git@github.com:abraham/twitteroauth.git
*
* Get your OAuth credentials:
* http://dev.twitter.com/pages/oauth_single_token
*/
require_once('twitteroauth/twitteroauth.php');
echo '<pre>';
$connection = new TwitterOAuth('consumer key', 'consumer secret', 'access token', 'access token secret');
$annotations = array('foo' => array('bar' => 'baz'));
$result = $connection->post('statuses/update', array( 'status' => 'Hello annotated world!',
'annotations' => json_encode($annotations)));
if (200 == $connection->http_code) {
echo 'Success! :)';
} else {
echo 'Failure! :(';
}
echo '<br><br>';
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment