another 'POST from perl' question

J

JD

Hi,
I've searched for several weeks, and I've found code that should allow
me to post from my perl script. I continue to fail, though.
Admittedly, I am not good with OOP (other than VB). I'm trying to post
so as to process credit card info, and authorize.net states that I must
POST with a query string (?), but don't use GET. In short, I've tried:
use CGI; use LWP::UserAgent; use HTTP::Request;
use HTTP::Status; $cgi = new CGI;
my $ua = LWP::UserAgent->new;
my $submit_str = "x_login=$acct_id&x_tran_key=$tran_key";
my $request = new HTTP::Request 'POST', $transaction_server;
$request->content_type('application/x-www-form-urlencoded');
$request->content($submit_str);
my $response = $ua->request($request);
$resp = $response->content;
if ($response->is_success) { print "Success"; }
else { print "Fail"; }

and I've tried a combination of variations:
my $response = $ua->request(POST $transaction_server,
['x_login' => $acct_id, 'x_tran_key' => $tran_key],);

including passing my data as a query_string, but I just can't make it to
is_success. I also can't decipher the hash that LWP appears to return.

I've looked at cpan, perl.com, and my cookbook, but to no avail. Tech
support doesn't support scripts, so they're little help.

Any suggestions or help? I apologize for my ignorance.
Thank you,
-jd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top