Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Twitter POSTer

by wizbancp (Sexton)
on Feb 12, 2007 at 10:28 UTC ( #599526=sourcecode: print w/replies, xml ) Need Help??
Category: Web Stuff
Author/Contact Info wizbancp
Description: A code for posting update to your twitter account :-)
#!/usr/bin/perl -w

require LWP::UserAgent;

$username = "yourusernamehere";
$password = "yourpasshere";

my $ua = LWP::UserAgent->new;
$ua->agent('WizTwitterBot/1.0');
$ua->timeout(10);
$ua->env_proxy;
$ua->credentials(
    'twitter.com:80',
    'Twitter API',
    $username => $password,);

sub pausa #mette in pausa il programma prima di uscire
{
   print "\nPremi Invio per continuare\n";
   my $pausa = <STDIN>;
} #fine subroutine pausa
  

sub twitter_post {
    $inputtext = shift;
    
    my $update_url = 'http://twitter.com/statuses/update.xml';

    # POST the update to twitter
    my $response = $ua->post($update_url, [status => $inputtext ]);

    # Inform the user if success...
    if ($response->is_success) {
        print "Twitter Updated!!!\n";
    } else {
        print "Update to Twitter failed...\n";
    }

}

print "Insert your update: ";
$update = <STDIN>;
chomp($update);

twitter_post ($update);
pausa;


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://599526]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2019-12-10 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?