Hi,
I am developing a shopping-cart application and i need to
authorize the credit-card no. of the customer.
I need to use a post method thru my php-script a replica
of which I am giving below:
Script Start:
// Build the request string
$request.='cardnum='.urlencode("0000111122223333");
$request.='&address='.urlencode("99 xyz");
$request.='&zipcode='.urlencode("96004");
$request.='&amount='.urlencode("2.00");
// Build the header
$header="POST /cgi-bin/xyz.exe HTTPS/1.0\r\n";
$header.="Host: secure.aaa.com\n". "User-Agent: PostIt\r\n";
$header.="Content-type: application/x-www-form-urlencoded\r\n";
$header.="Content-length: ".strlen($request)."\r\n\r\n";
// Open the connection
$fp = fsockopen('secure.aaa.com',443,&$err_num,&$err_msg);
$i=0;
if ($fp)
{
// Send everything
fputs($fp,$header.$request);
// Get the response
$response="I am in";
while (!feof($fp))
{
$response.=fgets($fp,128);
$i++;
}
fclose($fp);
}
else
$response="Dead";
?>
<html>
<head>
<title>Response from aaa.com</title>
</head>
<body bgcolor="#FFFFFF">
<p>
<? echo "Response from aaa: ".$response; ?>
<? echo "<br>No. of loops: ".$i; ?>
<? echo "<br>Error no: ".$err_num." Error Message: ".$err_msg; ?>
</p>
</body>
</html>
Script End.
In the above code I am posting my form data to
https://secure.aaa.com/cgi-bin/xyz.exe which
processes the credit card and returns some
string values showing whether the credit-card
is valid or not.
My question is that whether the method I'm
using is correct to post data to secure servers.
Well my code runs on a normal server ie. non-
secure.
My code is able to connect to the secure
server i.e fsockopen works but i do not get
any response from the server.
Well you can judge this by the result I am
getting on my browser.
The result I am getting on browser is:
Response from aaa: I am in
No. of loops: 1
Error no: 0 Error Message:
So am i doing anything wrong somewhere or is
there some other way to do this thing.
Please help asap. I need to finish this stuff by 27th
of this month.
regards
George
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]