Jump to content
Sign in to follow this  
NGR

Xml driving me nuts....

Recommended Posts

Hiya guys...

 

Okay, after losa of hassles. Can someone actually tell me how the string should look when you want to post it to another host??

 

So far im using curl - and this is what im doing!

 

$transdetail = "<?xml version=\"1.0\"?><Safe><Merchant><SafeKey>{XXXXXXXX-X8X2-4XXF-XXXX-XXXXXXXXXXXX}</SafeKey></Merchant><Transactions><IA_Auth><MerchantReference>Test_08:32:30 PM</MerchantReference><PaymentMethod>ican</PaymentMethod><Amount>92901</Amount></IA_Auth></Transactions>";

Above is the xml code being loaded into a variable.

 

Then i post the the host using curl :

curl_setopt ($ch, CURLOPT_URL, "http://secure.safeshop.co.za/s2s/SafePay.asp");

            curl_setopt ($ch, CURLOPT_POST, 1);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, $transdetail);

    curl_setopt ($ch, CURLOPT_POSTFIELDSIZE, 0);

    curl_setopt ($ch, CURLOPT_TIMEOUT, 360);

    curl_setopt ($ch, CURLOPT_HEADER, 0);

    curl_setopt ($ch, CURLOPT_SSLVERSION, 3);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

 

 

if i check the variable just before sending this is the full string that is being sent :

 

(Is the the right format that should be sending for XML???)

http://secure.safeshop.co.za/s2s/SafePay.asp?<?xml version="1.0"?><safe><Merchant><SafeKey>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX}</SafeKey></Merchant><Transactions><IA_Auth><MerchantReference>Test_08:32:30 PM</MerchantReference><PaymentMethod>ican</PaymentMethod><Amount>92901</Amount></IA_Auth></Transactions></Safe>

 

Because nomatter what I do this is what is being returned :

 

<?xml version=\"1.0\" ?> <Safe> <LogRefNr>1185753</LogRefNr> <Error>XML Root Tag is incorrect should be <Safe> (10146)</Error> </Safe>

 

 

Thing is my first tag that is being sent IS "<Safe>" - anyone have any hints to why im not getting anywhere?!?

 

Thanks in advance guys!!

 

Nick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×