hoangthi Posted November 17, 2013 Share Posted November 17, 2013 (edited) 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 November 17, 2013 by hoangthi Quote Link to comment Share on other sites More sharing options...
requinix Posted November 17, 2013 Share Posted November 17, 2013 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); Quote Link to comment Share on other sites More sharing options...
hoangthi Posted November 17, 2013 Author Share Posted November 17, 2013 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 Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 17, 2013 Share Posted November 17, 2013 In requinix's example, the returned response from that site is saved in the variable $response. Quote Link to comment Share on other sites More sharing options...
hoangthi Posted November 17, 2013 Author Share Posted November 17, 2013 In requinix's example, the returned response from that site is saved in the variable $response. Yes, There is nothing in $response Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 17, 2013 Share Posted November 17, 2013 What does your cURL structure look like after adding your XML? Quote Link to comment Share on other sites More sharing options...
hoangthi Posted November 18, 2013 Author Share Posted November 18, 2013 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> Quote Link to comment Share on other sites More sharing options...
requinix Posted November 18, 2013 Share Posted November 18, 2013 "xmlfile.xml" is not XML. It is a filename. curl_setopt($curl, CURLOPT_POSTFIELDS, file_get_contents("xmlfile.xml")); Quote Link to comment Share on other sites More sharing options...
hoangthi Posted November 18, 2013 Author Share Posted November 18, 2013 "xmlfile.xml" is not XML. It is a filename. curl_setopt($curl, CURLOPT_POSTFIELDS, file_get_contents("xmlfile.xml")); I tried this but the response is still nothing Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 18, 2013 Share Posted November 18, 2013 (edited) Ignore. Edited November 18, 2013 by SocialCloud Quote Link to comment Share on other sites More sharing options...
requinix Posted November 18, 2013 Share Posted November 18, 2013 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? Quote Link to comment Share on other sites More sharing options...
hoangthi Posted November 19, 2013 Author Share Posted November 19, 2013 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.