Hi all
I'm trying to do script to connect to a online credit card processing company, but I don't want to send the users directly to then since my webserver it's in portuguese and there system it's in english.
This script scripts receive the POST request from a form and it should connect to the credit card processing company but it's not parsing the data correctly:
require Net::SSL;
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
$ENV{SSL_CIPHER}="EXP-RC4-MD5";
$sock = Net::SSL->new(PeerAddr => "secure.creditcardcompany.com", PeerPort => 443) | | die "Can't connect";
$mlength=length($data);
$sock->print("POST /cgi-bin/script.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;
}
The answer I receive it's "Sorry -- this order form cannot be processed. The merchant identification is missing or invalid. Please inform the merchant of the problem."
And I know that the information in the form it's correct because if I send it directly to the credit card company it works fine, so the problem is in the way the script it's sending the information.
Can anyone help?
Rogerio Morais
www.rogerle.com
I'm trying to do script to connect to a online credit card processing company, but I don't want to send the users directly to then since my webserver it's in portuguese and there system it's in english.
This script scripts receive the POST request from a form and it should connect to the credit card processing company but it's not parsing the data correctly:
Code:
#!/usr/local/bin/perl require Net::SSL;
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
$ENV{SSL_CIPHER}="EXP-RC4-MD5";
$sock = Net::SSL->new(PeerAddr => "secure.creditcardcompany.com", PeerPort => 443) | | die "Can't connect";
$mlength=length($data);
$sock->print("POST /cgi-bin/script.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;
}
The answer I receive it's "Sorry -- this order form cannot be processed. The merchant identification is missing or invalid. Please inform the merchant of the problem."
And I know that the information in the form it's correct because if I send it directly to the credit card company it works fine, so the problem is in the way the script it's sending the information.
Can anyone help?
Rogerio Morais
www.rogerle.com