Prev | Current Page 736 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

However, we
will take advantage of PHP 5??™s SimpleXML extension, which makes reading simple XML data
a piece of cake.
Although less complex and powerful than DOMDocument, the SimpleXML extension
makes parsing XML data easy by transforming it into a data structure we can simply iterate
through. You first met the SimpleXML extension in Chapter 6.
?– Note For the code that communicates with DataCash, we use the cURL library (http://curl.haxx.se/).
Uncomment the following line in php.ini by removing the leading semicolon: extension=php_curl.dll.
Then restart Apache.
You??™ll find the php.ini file in the C:\xampp\apache\bin\ folder on Windows or the /opt/lampp/etc
folder on Linux.
For more details about the cURL library, check out the excellent tutorial at http://www.zend.com/pecl/
tutorials/curl.php. The official documentation of PHP??™s cURL support is located at http://www.php.net/
curl.
Exercise: Communicating with DataCash
1. Create a new file named datacash_request.php in the business folder, and add the following code to it:
class DataCashRequest
{
// DataCash Server URL
private $_mUrl;
// Will hold the current XML document to be sent to DataCash
private $_mXml;
// Constructor initializes the class with URL of DataCash
public function __construct($url)
{
// Datacash URL
$this->_mUrl = $url;
}
/* Compose the XML structure for the pre-authentication
request to DataCash */
public function MakeXmlPre($dataCashClient, $dataCashPassword,
$merchantReference, $amount, $currency,
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 630
$cardNumber, $expiryDate,
$startDate = '', $issueNumber = '')
{
$this->_mXml =
"

Pages:
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
Rowy noclegi tatralandia hotele świnoujście noclegi Namioty Mazury i interesująca cena South park