Created
July 3, 2010 16:32
-
-
Save ryu22e/462675 to your computer and use it in GitHub Desktop.
Wassrに画像を投稿するサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
# TODO Input your user id. | |
use constant WS_LOGIN_ID => ''; | |
# TODO Input your password. | |
use constant WS_PASSWORD => ''; | |
use constant WS_API_URL => 'http://api.wassr.jp/statuses/update.json'; | |
use constant WS_API_NAME => 'test'; | |
my $message = 'test'; | |
# TODO Input image file path. | |
my $file_path = ''; | |
my $ua = LWP::UserAgent->new( agent => WS_API_NAME ); | |
$ua->credentials( 'api.wassr.jp:80', 'API Authentication', | |
WS_LOGIN_ID, WS_PASSWORD ); | |
$ua->post( | |
WS_API_URL, | |
Content_Type => 'multipart/form-data', | |
Content => [ | |
status => $message, | |
source => WS_API_NAME, | |
image => [$file_path], | |
] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment