Created
June 2, 2012 09:16
-
-
Save ichigotake/2857485 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use Encode qw/encode_utf8/; | |
| use HTTP::Request::Common; | |
| use LWP::UserAgent; | |
| use Data::Dumper; | |
| my $ua = LWP::UserAgent->new; | |
| my $text = <<TEXT; | |
| #public | |
| Hello world! | |
| #test1 #test2 | |
| TEXT | |
| my $req = POST('http://localhost.net:3000/api/post', [ | |
| text => encode_utf8( $text ), | |
| token => '0000000000000000000000000000000000000000000000000000000000000000', | |
| ]); | |
| my $res = $ua->request($req); | |
| if ( $res->status_line == 200 ) { | |
| print "success!"; | |
| } | |
| else { | |
| print "faild post: ". $res->status_line; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment