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. > > > <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> > > > -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php