Fix or Rewrite Perl Script

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Scripts & Utilities Posted 2 years ago

Fixed Price

Delivery by January 21, 2013

$50.00

Budget

Details

#!/usr/bin/perl

$url = "http://www.zenlyzen.com/test1";
$msg = "test%20message";
$email = "a@a.com";
$name = "foo%20bar";

sub sndmsg {
    @mdump = `mech-dump --forms '$url/index.php?main_page=contact_us'`;
foreach $line (@mdump) {
    if ($line =~ /POST/) {
print "$line";
$line =~ /zenid=(\w+)/;
$zenid = $1;
    }
    if ($line =~ /securityToken/) {
$line =~ /securityToken=(\w+)/;
$sectoc = $1;
}
}
#    print "curl -A \"Mozilla/5.0\" -L -b securityToken=$sectoc -s -d \"contactname=$_[3]&mail=$_[2]&enquiry=$_[1]\" $_[0]/index.php?main_page=contact_us\\&action=send%20method=\"post\" > test.html\n";
    system "curl -A \"Mozilla/5.0\" -L -b securityToken=$sectoc -s -d \"contactname=$_[3]&mail=$_[2]&enquiry=$_[1]\" $_[0]/index.php?main_page=contact_us\\&action=send%20method=\"post\" > test.html";

}
sndmsg($url, $msg, $email, $name);
exit;

I hope this will be pretty much self explanatory. You may use strict and warn but this is not required. I do not want perl modules used, stick to the backticks and system commands. I don't care if you end up using curl, wget, mech-dump, or other GPL software. Avoid long and convoluted patterns. Break them up and document them with comments. Same thing for if statements. The sndmsg subroutine is supposed to post the appropriate data to the form. $url is the base url for the site. I have three more test sites set up for testing.

---
Skills: test


About the Client

(5.00) 5 reviews

United States
Memphis 02:02 AM

10 Jobs Posted
50% Hire Rate, 1 Open Job

$843 Total Spent
5 Hires, 0 Active

$16.67/hr Avg Hourly Rate Paid
26 Hours

Member Since Jul 17, 2012