note 39668 deleted from ref.curl by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 06 Feb 2004 20:25:17 +0000 |
| Subject: | note 39668 deleted from ref.curl by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64741@lists.php.net to get a copy of this message | ||
Note Submitter: ice@mgzhome.com
----
if you are looking to build an credit card processing system which takes info on your website but
validates it behind scene with your payment gateway, then curl can be very useful for you ...
(tested the following with skipjack and other popular payment gateways) ...
// Prepare your post data
$transaction_details = "";
while(list($name,$value) = each($_POST))
{
$transaction_details .= "$name=".urlencode($value)."&";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://your_payment_gateway_script");
curl_setopt ($ch, CURLOPT_PORT, "443");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $transaction_details);
ob_start();
curl_exec ($ch);
// Fetch any reply from the server
$transaction_reply = ob_get_contents();
ob_end_clean();
curl_close ($ch);
// Continue your site design with appropriate messages based on the reply ...