I wish to receive information that is submitted by a form. The information that is received will then be securely sent to another site and that site will securely return responses.
The code below is setup just for testing purposes so that I can tell what is going on with the program. Eventually it will send information to Authorizenet.
1. I have looked all over the web with keywords such as NET::SSL and "Authorize.net CGI" and various combinations and nothing helpful is presented.
2. The Authorize.net site doesn't explain this process.
3. I have researched other areas as well, and all I seem to come up with is more confusion on how to accomplish this goal.
My temporary setup goes like this:
I use a form with just a simple box and the form posts to authorizenettest.cgi. The authorizenettest.cgi file posts to submit_to_me.cgi (this would eventually be Authorize.net). The submit_to_me.cgi is simply supposed to return the values it receives. However, it doesn't do so.
Here's what I have so far...
PHP Code:THE authorizenettest.cgi FILE (receiving info from a form)
#!/usr/bin/perl
print "Content-type: text/html\n\n";
require Net::SSL;
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
$ENV{SSL_CIPHER}="EXP-RC4-MD5";
$sock = Net::SSL->new(PeerAddr => "nucleic-secure.com", PeerPort => 443) || die "Can't connect";
$mlength=length($data);
$sock->print("POST /~activewe/cgi-bin/submit_to_me.cgi HTTP/1.0\n\n");
$sock->print("Accept: www/source\n");
$sock->print("Accept: text/html\n");
$sock->print("Accept: text/plain\n");
$sock->print("User-Agent: Mozilla/4.0\n");
$sock->print("Content-type: application/x-www-form-urlencoded\n");
$sock->print("Content-length: $mlength\n\n");
$sock->print("$data\n");
while ($sock->read($buf, 1024)) { $resp.=$buf; }
print "<font face=Arial>\$resp=$resp <p>";
The only response that I get is:PHP Code:THE submit_to_me.cgi FILE (receiving info from authorizenettest.cgi)
#!/usr/bin/perl
use CGI;
my $in = new CGI;
# print "Content-type: text/html\n\n";
print $in->header('text/plain');
foreach ($in->param) {
print "$_ => ", $in->param($_), "<br>\n\n";
}
$resp=HTTP/1.1 200 OK Date: Tue, 29 Apr 2003 21:17:07 GMT Server: Apache/1.3.27 (Unix) DAV/1.0.3 mod_log_bytes/1.2 mod_bwlimited/1.0 PHP/4.3.1 FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6b PHP-CGI/0.1b Connection: close Content-Type: text/plain; charset=ISO-8859-1
If I remove the print command and the print "Content-type: text/html\n\n"; from authorizenettest.cgi, I simply receive a 500 error.
I know that both programs are correct in the syntax (I did run Perl via Telnet on both).
I'm also worried that Net::SSL is depreciated and may not be the best choice to use. I'd rather not rely upon something that could disappear in an upgrade.
Any help is highly appreciated.
Roger


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks