curl-library
Curl::easy / Authorize.net
Date: Wed, 16 Apr 2003 03:02:34 -0500 (GMT)
Has anyone used Curl::easy with Authorize.net? I am having a terrible time trying to connect successfully and transmit data to them. I make the post OK it seems, but they return an error about using the wrong integration method, though I've checked and re-checked and it all seems right. There are lots of curl and php examples out there, but I have to go through Perl on my server. My code is below:
##begin code##
#!/usr/bin/perl -w
use strict;
use CGI qw(:all);
use Curl::easy;
my $ccnum = "5424000000000015";
my $ex1 = "04";
my $ex2 = "05";
my $total = "120.50";
my $expdate = $ex1 . $ex2;
my $datapost = "x_Version=3.1&x_Delim_Data=True&x_Password=[removed]&x_Login=[removed]&x_Tran_Key=[removed]";
my $url = "https://secure.authorize.net/gateway/transact.dll";
$datapost .= "&x_Amount=" . $total;
$datapost .= "&x_Card_Num=" . $ccnum;
$datapost .= "&x_Exp_Date=" . $expdate;
$datapost .= "&x_Type=AUTH_CAPTURE&x_Test_Request=TRUE&x_Method=CC";
my $curl = Curl::easy->new() or die "curl init failed!\n";
$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURLOPT_HEADER, 1);
$curl->setopt(CURLOPT_POST, 1);
$curl->setopt(CURLOPT_POSTFIELDS, $datapost);
my $returnstring = $curl->perform();
print "Content-type: text/html\n\n";
print "$returnstring\n";
##end code##
I know this is barbones, but I've already had to get rid of other potential problems just to post to them and get any kind of response. Any advice welcome, especially if you've dealt with Authorize.net.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-04-16