Here's what I would do.
1. Download the page with the form you want to your computer.
2. Delete the part in the form where it says action="example.php (or whatever)" and put in "formpairs.pl (saved in the same location or whatever)". The script below is formpairs.pl.
#!/usr/bin/perl
# formpairs.pl - extract names and values from HTTP requests
use strict;
use warnings;
my $data;
if(! $ENV{'REQUEST_METHOD'}) { # not run as a CGI
die "Usage: $0 \"url\"\n" unless $ARGV[0];
$data = $ARGV[0];
$data = $1 if $data =~ s/^\w+\:.*?\?(.+)//;
print "Data from that URL:\n(\n";
} elsif($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
print "Content-type: text/plain\n\nPOST data:\n(\n";
} else {
$data = $ENV{'QUERY_STRING'};
print "Content-type: text/plain\n\nGET data:\n(\n";
}
for (split '&', $data, -1) { # Assumes proper URLencoded input
tr/+/ /; s/"/\\"/g; s/=/\" => \"/; s/%20/ /g;
s/%/\\x/g; # so %0d => \x0d
print " \"$_\",\n";
}
print ")\n";
__END__
3. Open the page up in your browser locally, and then run the code by submitting the form.
4. This should show you what values you need in your form.
Also check out Perl & LWP by Sean Burke. That's where this code was taken from.
From there I use
$mech->set_fields(); to input the form info.
Have fun spamming Myspace! ;)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.