A random collection of stuff that I want online.
Home8 February 2010 2:51pm. permalink
Here's a quick post of a tweet() function that can be used to post to Twitter in Sapphire /
SilverStripe CMS.
function tweet($username, $password, $tweet) {
$rs = new RestfulService('http://twitter.com/',-1);
$rs->basicAuth($username, $password);
$headers = array('Expect: ');
$response = $rs->request('statuses/update.xml', 'POST', array(
'status' => $tweet,
), $headers);
if($response->getStatusCode() != 200) throw new Expection("Tweet couldn't be posted to $username account");
}