Okay, building up a credit card authorization scheme that is server-side only [the web-client never sees it] ... code:
$name = 'some name;
$ccnum= 123456789;
$amount = 12;
//build up the http request
$request = 'name=' . urlencode($name);
$request .= '&ccnum=' . urlencode($ccnum);
$request .= '&amount=' . urlencode($amount);
// build up the header
$header = "POST http://secure.authorize.net/authorize.dll HTTP/1.0\r\n";
$header .= "Content-type: application/x-www-form-urlencoded\r\n";
$header .= "Content-length: " . strlen($request) . "\r\n\r\n";
// connect up to the authorizer
$http_connect = fsockopen('http://secure.authorize.net/authorize.dll', 80, &$err_num, &$err_msg, 30);
if ($http_connect)
{
// send headers and request
fputs($fp, $header . $request);
// Get the response
while (!feof($http_connect))
$response .= fgets($http_connect, 128);
}
this code contacts a remote server, sends out some ccinfo, and gets a response about whether or not the credit card is good for processing. Now, the real question :: any way to do this securely? Like, open up an SSL connection to secure.authorize.net/authorize.dll?
Any hints would be really helpful,
Thanks!
randal@hpi.net