note 39668 added to ref.curl

From: Date: Fri, 06 Feb 2004 19:34:47 +0000
Subject: note 39668 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-64739@lists.php.net to get a copy of this message
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 ... ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39668 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39668&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39668&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64739) next »