0\" encoding=\"UTF-8\"\x3F>
$dataCashPassword
$dataCashClient
$merchantReference
$amount
pre
$cardNumber
$expiryDate
$startDate
$issueNumber
";
}
// Compose the XML structure for the fulfillment request to DataCash
public function MakeXmlFulfill($dataCashClient, $dataCashPassword,
$authCode, $reference)
{
$this->_mXml =
"
$dataCashPassword
$dataCashClient
$reference
$authCode
fulfill
";
}
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 631
// Get the current XML
public function GetRequest()
{
return $this->_mXml;
}
// Send an HTTP POST request to DataCash using cURL
public function GetResponse()
{
// Initialize a cURL session
$ch = curl_init();
// Prepare for an HTTP POST request
curl_setopt($ch, CURLOPT_POST, 1);
// Prepare the XML document to be POSTed
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_mXml);
// Set the URL where we want to POST our XML structure
curl_setopt($ch, CURLOPT_URL, $this->_mUrl);
/* Do not verify the Common name of the peer certificate in the SSL
handshake */
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// Prevent cURL from verifying the peer's certificate
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
/* We want cURL to directly return the transfer instead of
printing it */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Perform a cURL session
$result = curl_exec($ch);
// Close a cURL session
curl_close ($ch);
// Return the response
return $result;
}
}
?>
2.
Pages:
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749