arul's code
free code snippets

Twitter script to set status

Twitter script to set status

This is a small script to automate Twitter status updates. Use it at your own risk. :)

Substitute MYUSERNAME for your real username and MYPASSWORD for your real password.


#!/usr/bin/perl

use strict;
use warnings;
use LWP::UserAgent;

# Set twitter status
my $status = shift || die "Enter Twitter status as parameter\n";

# Create user-agent
my $browser = LWP::UserAgent->new();
$browser->credentials('twitter.com:80', 'Twitter API', 'MYUSERNAME', 'MYPASSWORD');
my $response = $browser->get('http://twitter.com/account/verify_credentials.json');
print $response->content."\n";
$response = $browser->post('http://twitter.com/statuses/update.json', { status => $status });
print $response->content."\n";

Share this

Last Updated: Posted on 07 Feb 2015