I had a script written for me a while back and it work fine until recently I had to add a URL like http://www.domain.com/0306/0129.php?rid=userid
problem is when it post it it post http://www.domain.com/0306/0129.php?rid missing the =userid
Sadly I can not get in touch with the person who wrote the script for me so I have been trying to work it out myself but not knowing what I am doing this is hard. I have worked out (at least I think I have) that I need to add urldecode but where and how I do not have an idea here is the code:
$dbh = DBI->connect( $data_source, $username, $password )
or die "Can't open $data_source! $dbh->errstr\n";
$sth = $dbh->prepare("Select * from base20 where dt is null order by gid asc limit 1;");
$rows = $sth->execute;
my $i = 0;
while ( ($rows == 0) && ($i++ < 5))
{
$sth = $dbh->prepare("update base20 set dt = null;");
$sth->execute or die "Could not exec update!\n$dbh->errstr\n";
$sth = $dbh->prepare("Select * from base20 where dt is null limit 1;");
$rows = $sth->execute;
}
my $row_hash = $sth->fetchrow_hashref;
$sth = $dbh->prepare("update base20 set dt = curdate() where gid = '$row_hash->{gid}'");
$sth->execute;
$sth->finish;
$dbh->disconnect;
my test $tmp;
$tmp="id=" . $row_hash->{id} . "&pass=" . $row_hash->{pass};
$tmp .= "&gurl=" . $row_hash->{gurl} . "&num=" . $row_hash->{num};
$tmp .= "&cat=" . $row_hash->{cat} . "&type=" . $row_hash->{type} . "&submit=Post+This+Gallery";
$tmp .="&fnct=post_gallery&desc=" . $row_hash->{dsc};
my $h = new HTTP::Headers;
$h->header( Referer => $target);
my $u = URI->new( $target );
$u->query_form($tmp);
my $ua = new LWP::UserAgent;
$ua->agent('Mozilla/5.0');
my $req = new HTTP::Request( 'POST', $u, $h);
$req->content_type('application/x-www-form-urlencoded');
#$tmp = uri_escape($tmp);
$req->content($tmp);
$req->uri( $u );
my $res = $ua->request( $req );
It would be great if anyone can help
Thanks in advance