<?php
/**
* Simple Twitter Status Update - 3 lines of code!
*/
require('TwitterUpdater.class.php');
$twitter = new TwitterUpdater("myusername","mypassword");
$twitter->updateStatus('I am a tweeeter!! This my API tweet!');
//uncomment this line to see response from Twitter
//echo twitter->getReponse();
/**
* Another Twitter Status Update, but with a long URL
*
* If you need tweet a long URL with your tweet post,
* parse your long URL with built-in bit.ly to get a short URL,
* don't waste your precious tweet characters:)
*
* Get a free Bit.ly API key: http://bit.ly/account/your_api_key
*/
$twitter->setupBitly("BITLY_USERNAME", "BITLY_API_KEY");
$myurl = $twitter->bitlyURL('http://www.tmhits.com/music/Ma-Ro/Sana-bagly-1457');
//myurl is now shortened to something like: http://bit.ly/fkAdjd
$twitter->updateStatus($myurl. '- Check this nice song. Artist: Ma-Ro, title: Sana bagly. This is a long tweeet!');
/**
* Retrieve Your Tweets
*/
// Get most recent 20 tweets (Tweeter default)
$statuses = $twitter->getUserTimeline();
//statuses is array [text, created_at, source, id]
echo $statuses[0][0];
//Get any number of tweets, just pass it as a parameter
$statuses = $twitter->getUserTimeline($count=5);
/**
* Delete a tweet
*/
//Pass tweet id. IDs are returned with getUserTimeline() call
$twitter->destroyStatus($id);
/**
* Update status of your other Tweeter account
*/
$twitter->setUsername('MyOtherTweeterUsername');
$twitter->setPassword('MyOtherTweeterPassword');
$twitter->updateStatus('Now I am tweeting on my other Account! How cool is that?');
?>
|