<?
$url="https://secure.quantumgateway.com/cgi/xml.php";
$LOGINURL = "$url";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (affgrabber)";

$xml="<QGWRequest>
<Details>
<gwLogin>your gwid</gwLogin>
<RestrictKey>the RestrictKey</RestrictKey>
<ResponseType>Response</ResponseType>
<post_back_url>your url</post_back_url>
</Details>
<TransactionRequest>
<trans_method>CC</trans_method>
<ccnum>5454545454545454</ccnum>
<ccmo>12</ccmo>
<ccyr>2010</ccyr>
<amount>10.00</amount>
<BADDR1>1212 15th St NW</BADDR1>
<BZIP1>99999</BZIP1>
</TransactionRequest>
</QGWRequest>"

$POSTFIELDS = "&xml=$xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$result = curl_exec ($ch);
curl_close ($ch);
$mytest = $result;

 

if(preg_match("/APPROVED/i","$mytest")) {
#Parse xml and Do your APPROVED routine
} else {
#either decline or error.
}

?>