Jump to content

How to "POST" a XML content to a url


hoangthi

Recommended Posts

The service says that:

Requests should be sent to: https://w3s.webmoney.ru/asp/XMLTrans.asp

 Method: POST

and it is Request format:

 

 

<w3s.request>
<reqn></reqn>
<wmid></wmid>
<sign></sign>
<trans>
<tranid></tranid>
<pursesrc></pursesrc>
<pursedest></pursedest>
<amount></amount>
<period></period>
<pcode></pcode>
<desc></desc>
<wminvid></wminvid>
<onlyauth></onlyauth>
</trans>
</w3s.request>
so, How can I do :( Edited by hoangthi
Link to comment
Share on other sites

cURL is the easiest. Find a quick primer on it (it's not difficult to use) and pay attention to the CURLOPT_POSTFIELDS setting. Your code should look something like

$curl = curl_init("https://w3s.webmoney.ru/asp/XMLTrans.asp");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, "your xml here");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
curl_close($curl);
Link to comment
Share on other sites

cURL is the easiest. Find a quick primer on it (it's not difficult to use) and pay attention to the CURLOPT_POSTFIELDS setting. Your code should look something like

$curl = curl_init("https://w3s.webmoney.ru/asp/XMLTrans.asp");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, "your xml here");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
curl_close($curl);

 

I did this, but Nothing happended
Link to comment
Share on other sites

What does your cURL structure look like after adding your XML?

Oh I used Requinix 's example:

 

$curl = curl_init("https://w3s.webmoney.ru/asp/XMLTrans.asp");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, "xmlfile.xml");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

echo $response = curl_exec($curl);
curl_close($curl);

xmlfile.xml:

 

<w3s.request>
<reqn>123</reqn>
<wmid>abc</wmid>
<sign>123</sign>
<trans>
<tranid>123</tranid>
<pursesrc>123</pursesrc>
<pursedest>123</pursedest>
<amount>12</amount>
<period>123</period>
<pcode>123</pcode>
<desc>123</desc>
<wminvid>123</wminvid>
<onlyauthabc></onlyauth>
</trans>
</w3s.request>
Link to comment
Share on other sites

I assume you've done something to try to troubleshoot what's wrong, and not just tell us it doesn't work and wait for an answer? What have you tried? Have you checked the HTTP response code, which involves curl_getinfo? Have you checked that you're sending the right XML? Have you done a View Source on the page to see if maybe, just maybe, you were outputting XML and so couldn't see the markup because the browser was pretending it was HTML?

Link to comment
Share on other sites

I assume you've done something to try to troubleshoot what's wrong, and not just tell us it doesn't work and wait for an answer? What have you tried? Have you checked the HTTP response code, which involves curl_getinfo? Have you checked that you're sending the right XML? Have you done a View Source on the page to see if maybe, just maybe, you were outputting XML and so couldn't see the markup because the browser was pretending it was HTML?

of course I viewed the source, Nothing... I will try again!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.