trying to post to credit card authorization gateway - ibill

From: Date: Thu, 29 Aug 2002 03:14:03 +0000
Subject: trying to post to credit card authorization gateway - ibill
Groups: php.general 
Request: Send a blank email to php-general+get-114452@lists.php.net to get a copy of this message
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>

« previous php.general (#114452) next »