Hi Guys.
A payment gateway needs me to post them information in exchange for an xml feed with the payment information.
So what I have done is the following :
$url = "http://www.setcom.com/secure/components/synchro.cfc?wsdl";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 20); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "method=tnx_synchro&identifier=1234567890&usrname=testseller@setcom.com&pwd=testseller&tnxid=B43DDDD3-BB5D-4CD4-8621-65FA4EE149F2&checksum=4F49DE1B953A71836AEA8D95424B3CE1&parity=9002344");
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
Now - the result that prints on the screen seems perfect
<?xml version="1.0" encoding="UTF-8"?><tnx_synchro><outcome><status>Complete</status><transaction_id>b43dddd3-bb5d-4cd4-8621-65fa4ee149f2</transaction_id></outcome><member><identifier>1234567890</identifier><username>testseller@setcom.com</username><reference>1234568039</reference></member><buyer><username>testbuyer@setcom.com</username><shipping_address><email_address/><street1/><street2/><city/><state/><zip/><country/></shipping_address><billing_address><email_address/><street1/><street2/><city/><state/><zip/><country/></billing_address></buyer><payment_instrument><type>Credit Card</type><brand>MasterCard</brand><card_name>Setcom Test Buyer</card_name><card_number>XXXX-XXXX-XXXX-5454</card_number></payment_instrument><financial><amount_total>200</amount_total><currency>ZAR</currency></financial><line_items count="1"><lid><sku>CODE</sku><description>Product Description</description><price>200</price><quantity>1</quantity><weight>0</weight><height>0</height><width>0</width><length>0</length><color/><size/><handling>0</handling><require_shipping>0</require_shipping><is_voucher>0</is_voucher></lid></line_items><transactions count="1"><transaction_id>b43dddd3-bb5d-4cd4-8621-65fa4ee149f2</transaction_id><type>funds_purchase</type><seller_reference>1234568039</seller_reference><buyer_reference/><statement row="1"><type>funds_received</type><date_added>20050726172021</date_added><reference>2831</reference><error_code>0</error_code><authorization_number/><transaction_key/><amount>200</amount><fee>-410</fee><tax>-57</tax><rolling_reserve>0</rolling_reserve><nett>-267</nett><balance>10504481</balance><rolling_reserve_balance>0</rolling_reserve_balance><funds_available>20050726172021</funds_available><rolling_reserve_available>20050726172021</rolling_reserve_available></statement></transactions></tnx_synchro>
Now the problem is decoding this information and putting it into variables.
I have tried to use RPCXML parser to parse the information, with no luck :
$response = $result;
$data = XML_unserialize(substr($response, strpos($response, "\r\n\r\n")+4));
$return = array();
$return[0] = true;
$return[1] = XMLRPC_adjustValue(&$data['tnx_synchro']['outcome']['status']);
Keeps on getting blank arranys. Tried a number of parsers and nothing seems to work. Would it be the way that I am getting the information from the gateway??
Please guys help me out if you know how - spend almost 2 weeks researching with no luck 🙁
Thanks,
Nick