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 :(
Link to comment
https://forums.phpfreaks.com/topic/283987-how-to-post-a-xml-content-to-a-url/
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);
  On 11/17/2013 at 1:14 PM, requinix said:

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
  On 11/17/2013 at 6:44 PM, SocialCloud said:

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>

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?

  On 11/18/2013 at 6:34 PM, requinix said:

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.