johnsmith153 Posted May 11, 2012 Share Posted May 11, 2012 I'm trying to send this: <?xml version="1.0" encoding="utf-8"?> <Request version="1.0" xmlns="http://europay.smart2pay.com/message"> <Action>INSERT_PAYIN</Action> <MID>F520156B-5E64-447F-B0B2-C638FA101C6F</MID> <PaymentMethod>mercadopago</PaymentMethod> <IPAddress>127.0.0.1</IPAddress> <Hash>F83525BC77811EC24FF10E50383BB5ED</Hash> <Details> <MTID>123456789</MTID> <Amount>100</Amount> <Currency>REA</Currency> <SuccessURL>http://www.smart2pay.com/success.html</SuccessURL> <FailureURL>http://www.smart2pay.com/failure.html</FailureURL> <CancelURL>http://www.smart2pay.com/cancel.html</CancelURL> <ProcessingURL>http://www.smart2pay.com/processing.html</ProcessingURL> <Shipping Amount="50" CostMode="DS" /> <Language>pt-BR</Language> <Description>payment</Description> <CustomerName FirstName="John" LastName="Doe" /> <CustomerEmail>[email protected]</CustomerEmail> </Details> </Request> to this: https://europaytest.smart2pay.com/MerchantService.asmx?wsdl How do I do it? Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/ Share on other sites More sharing options...
xyph Posted May 11, 2012 Share Posted May 11, 2012 How are they expecting it? cURL would allow you to make a POST request to that site, with the XML data. If their script isn't expecting POST data though, they wouldn't get it. Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344830 Share on other sites More sharing options...
johnsmith153 Posted May 11, 2012 Author Share Posted May 11, 2012 Thanks for the reply. To action you must 'call the web service method named SubmitRequest' I might be wrong, but as the url is https://europaytest.smart2pay.com/MerchantService.asmx?wsdl is this different as it's not a web site (e.g. index.php). Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344834 Share on other sites More sharing options...
silkfire Posted May 11, 2012 Share Posted May 11, 2012 You need to use SOAP. There are many tutorials out there, just Google. Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344838 Share on other sites More sharing options...
johnsmith153 Posted May 11, 2012 Author Share Posted May 11, 2012 Thanks to all for the help. Can you point me in the direction for my specific issue? I have tried this: $client = new SoapClient("https://europaytest.smart2pay.com/MerchantService.asmx?wsdl"); $response = $client->__doRequest($xml, "https://europaytest.smart2pay.com/MerchantService.asmx", "SubmitRequest", 1.1); ...but it just doesn't work saying "Server did not recognize the value of HTTP Header" Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344840 Share on other sites More sharing options...
silkfire Posted May 11, 2012 Share Posted May 11, 2012 You actually don't need to use the doRequest method. SOAP automatically creates all functions in the WSDL for you when it parses the specification. So just pass all the data as an array argument to the function: $client->SubmitRequest(array( 'MTID' => 'xxxx', 'Amount' => 0, 'Currency' => 0, 'SuccessURL' => 0, 'FailureURL' => 0, 'CancelURL' => 0, 'ProcessingURL' => 0, 'Shipping' => 0, 'Language' => 0, 'CustomerName ' => 0, 'CustomerEmail' => 0 )); Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344852 Share on other sites More sharing options...
johnsmith153 Posted May 11, 2012 Author Share Posted May 11, 2012 Thanks. What about this part? <Action>INSERT_PAYIN</Action> <MID>F520156B-5E64-447F-B0B2-C638FA101C6F</MID> <PaymentMethod>mercadopago</PaymentMethod> <IPAddress>127.0.0.1</IPAddress> <Hash>F83525BC77811EC24FF10E50383BB5ED</Hash> <Details> <MTID>123456789</MTID> <Amount>100</Amount> </Details> Do we need the Action and MID parts as these uniquely identify the user? Also, MTID, Amount etc. is inside a <Details> tag. Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344890 Share on other sites More sharing options...
johnsmith153 Posted May 11, 2012 Author Share Posted May 11, 2012 Also, I get a "object reference not set to instance of an object" error. I think I need to include all the other bits as well (like my unique web services user ID). Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1344894 Share on other sites More sharing options...
johnsmith153 Posted May 14, 2012 Author Share Posted May 14, 2012 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/262416-simple-send-xml-with-php/#findComment-1345338 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.