Re: [PHP] Using post method thru php-script
$fp = fsockopen('secure.aaa.com',443,$err_num,$err_msg); Talking to an SSL server on port 443 is a bit more complicated than chatting up an HTTP server on port 80. You have to pre-negotiate your encryption algorithms and send some public keys back and forth to generate some more public/private key-pairs and... While DIY is tons of fun, with a deadline of the 27th looming, I'd look into using cURL. Search the archives for URLs and further info on cURL. Last I heard, somebody was gonna integrate cURL direct into PHP, but I've been out of it for awhile. Oh yeah: I'm back! :-) -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- 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]
[PHP] Using post method thru php-script
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(); $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 titleResponse from aaa.com/title /head body bgcolor=#FF p ? echo Response from aaa: .$response; ? ? echo brNo. of loops: .$i; ? ? echo brError 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]