PERL to PHP help please
| From: | Shoguntrader | Date: | Tue, 16 Oct 2001 02:27:14 +0000 |
| Subject: | PERL to PHP help please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71160@lists.php.net to get a copy of this message | ||
I am looking to write a script that takes in a user id and a password, matches them with credit card
number and other info from a MySQL database and then sends it with a GET form command to a remote
cgi script.
<form action="cgi script" method="get">
//input user id
//input password
<?php
//connect to dbase
//find matching order info
//prepare string for get submit
?>
//submit button
</form>
How do I submit a certain string as a "GET" to a certain remote cgi? Am I making sense at
all? How do I choose what gets sent out as a "GET"?
How can I make it secure?
Here is the PERL example that the payment gateway gives:
$Postvals =
"merchant=$merchantname&password=$password&operation_type=$operation_type&";
$Postvals .= "orderid=$orderid&total=$total&cardname=$cardname&";
$Postvals .=
"cardnum1=$cardnum1&cardnum2=$cardnum2&cardnum3=$cardnum3&cardnum4=$cardnum4&";
$Postvals .=
"cardexpm=$cardexpm&cardexpy=$cardexpy&nameoncard=$nameoncard&cardstreet=$cardstreet&";
$Postvals .=
"cardcity=$cardcity&cardstate=$cardstate&cardzip=$cardzip&cardcountry=$cardcountry";
use LWP::UserAgent;
use Crypt::SSLeay;
$ua = new LWP::UserAgent;
$ua->agent("SSL/0.1");
my $req = new HTTP::Request('POST', 'https://www.goemerchant7.com/cgi-bin/gateway/gateway.cgi');
$req->content_type('application/x-www-form-urlencoded');
$req->content($Postvals);
my $res = $ua->request($req);
$Result = $res->content;
($success, $authcode, $authresponse, $avscode, $oid) = split(/\|/, $Result);
Any ideas?
Thank in advance,
Shay Horowitz
Shoguntrader
www.shoguntrading.com