Skip to content

Instantly share code, notes, and snippets.

@earino
Created July 7, 2012 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earino/3068269 to your computer and use it in GitHub Desktop.
Save earino/3068269 to your computer and use it in GitHub Desktop.
Using LWP to mess the content type
#!/usr/bin/env perl
use warnings;
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
my $req = POST 'http://localhost:3000/',
Content_Type => 'form-data',
Content => [ name => 'Eduardo Arino',
email => 'earino@gmail.com',
gender => 'M',
born => '1978',
filename => [
undef,
'file.jpeg',
'Content-Type' => 'image/jpeg',
'Content' => '<?php phpinfo(); ?>',
],
];
my $ua = LWP::UserAgent->new();
my $response = $ua->request($req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment