Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

trying to post to credit card authorization gateway - ibill

0 views
Skip to first unread message

Stan

unread,
Aug 28, 2002, 11:14:03 PM8/28/02
to php-g...@lists.php.net
The following was from a post over a year ago, where the author was trying
to post credit card info to an .exe gateway program to check authorization.
I am trying to get something similar to work. I can submit it and to the
gateway, but I never get the comma delimitted authorization string back from
the .exe gateway program. It may come back, but I am not sure how to get it
into my php program so that I can use it and take action. Here is the code I
am using... any suggestions? Stan


I get the following returned, but want to set up to get the actual credit
card authorization string
from the gateway. If I post with form fields it works fine, but with
fsockopen I never get the string. Does anyone know why I would not get the
credit card authorization string back, as I would with a manual post using
formfields?:


<html><body>

<?php

// Build the request string.
$request.='cardnum='.urlencode("0000111122223333");
$request.='&address1='.urlencode("99 xyz");
$request.='&zipcode='.urlencode("96004");
$request.='&amount='.urlencode("2.00");
// Build the header.
$header="POST /cgi-win/ccard/tpcard15.exe HTTPS/1.0\r\n";
$header.="Host: secure.ibill.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.ibill.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 secure.ibill.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>

Manuel Lemos

unread,
Aug 28, 2002, 11:26:12 PM8/28/02
to php-g...@lists.php.net
Hello,

On 08/29/2002 12:14 AM, Stan wrote:
> The following was from a post over a year ago, where the author was trying
> to post credit card info to an .exe gateway program to check authorization.
> I am trying to get something similar to work. I can submit it and to the
> gateway, but I never get the comma delimitted authorization string back from
> the .exe gateway program. It may come back, but I am not sure how to get it
> into my php program so that I can use it and take action. Here is the code I
> am using... any suggestions? Stan
>
>
> I get the following returned, but want to set up to get the actual credit
> card authorization string
> from the gateway. If I post with form fields it works fine, but with
> fsockopen I never get the string. Does anyone know why I would not get the
> credit card authorization string back, as I would with a manual post using
> formfields?:

fsockopen was not originally meant for SSL connections. You would need
to use OpenSSL or CURL functions.

Meanwhile SSL support was added for PHP 4.3.0 by prefixing the host name
with ssl:// . Anyway that version was not yet released.


--

Regards,
Manuel Lemos

Eric Bauer

unread,
Aug 28, 2002, 11:25:08 PM8/28/02
to Stan, php-g...@lists.php.net
I have done this with ASP and Authorize.net, so I'm not sure if it will work
for you, but all I did was in asp use a request.form("fieldname") which I
think would be like using $_POST['fieldname']; or
$HTTP_POST_VARS['fieldname'] (I'm still new to PHP).

Hope that helps


<html><body>

<?php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

0 new messages