Skip to content

Instantly share code, notes, and snippets.

@ryu22e
Created July 3, 2010 16:32
Show Gist options
  • Save ryu22e/462675 to your computer and use it in GitHub Desktop.
Save ryu22e/462675 to your computer and use it in GitHub Desktop.
Wassrに画像を投稿するサンプル
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