Skip to content

Instantly share code, notes, and snippets.

@ozuma
Created May 9, 2013 13:13
Show Gist options
  • Save ozuma/5547360 to your computer and use it in GitHub Desktop.
Save ozuma/5547360 to your computer and use it in GitHub Desktop.
POST(HTTP) raw content body.
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $url = "http://localhost/~ozuma/postdump.cgi";
my $post_body = <<POST_XML;
<?xml version="1.0" encoding="utf-8"?>
<sample>
<company>
<name>Example Company</name>
<url>http://www.example.com/<url>
</company>
</sample>
POST_XML
my $req= HTTP::Request->new(POST => $url);
$req->content($post_body);
print $ua->request($req)->as_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment