Bitwyse1
Bitwyse1

Reputation: 339

How to submit xml data to a web site?

I am using a third party to process transactions. They have an api that says XML content should submitted via an HTTP POST variable named “XML”.

I know how to create the xml, but not sure how to post it to their site. They have a destination url. Can you tell me how to do the Post to their site?

Upvotes: 2

Views: 262

Answers (1)

stwissel
stwissel

Reputation: 20384

You need to carefully check. Usually you just post XML to an URL. However in this case (indicated by the variable name) it seems that a (typically only used for html forms) form post is needed.

The easiest way is to create a html form with that one field, something like this:

  <form method="post" action="http://their url" name="payload">
     <input type="hidden" id="XML" name="XML" />
  </form>

Then you can fill the field with your XML and do a payload.submit()

Let us know how it goes

Upvotes: 5

Related Questions