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; |
Back to
Code Catacombs