require 'twitter/tmhOAuth.php';
require 'twitter/tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'foo',
'consumer_secret' => 'bar',
'user_token' => 'boo',
'user_secret' => 'far',
));
// Magic code that generates an interesting and unique $status
// Grabs a random line from a text file
// Makes an API call to somewhere else
// Etc.
$status = 'foo';
$code = $tmhOAuth->request(
'POST',
$tmhOAuth->url('1.1/statuses/update'),
array(
'status' => $status
),
);
// Add some useful output
echo "code=$code<br/>";
if ($code == 200) {
echo "response OK<br/>";
var_dump(json_decode($tmhOAuth->response['response']));
echo "<br/>";
}
else {
echo "response KO<br/>";
echo $tmhOAuth->response['response'];
echo "<br/>";
}