Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use utf8;
- use HTTP::Request::Common;
- use LWP::UserAgent;
- # TODO ここにログインIDを入れる
- use constant LOGIN_ID => '';
- # TODO ここにパスワードを入れる
- use constant PASSWORD => '';
- # TODO ここにStasutNetのURLを入れる
- use constant STATUSNET_URL => '';
- use constant API_PATH => '/api/statuses/update.xml';
- use constant MESSAGE => 'This is example.';
- my $url = STATUSNET_URL . API_PATH;
- my $req = POST( $url, [ status => MESSAGE ] );
- $req->authorization_basic( LOGIN_ID, PASSWORD );
- my $ua = LWP::UserAgent->new;
- my $res = $ua->request($req);
- if ( $res->is_success ) {
- print "Message is posted!\n";
- }
- else {
- print "Failed to post.\n";
- }
Add Comment
Please, Sign In to add comment