-1

I have a basic HTML form that needs to send POST data directly to a 3rd party website without passing through my web server?

how do I do this?

<form action="remote_url" method="post">

    <label>Security code:</label>
    <input name="CreditCardSecurityCode" type="text" maxlength="3" size="3" />
    <input name="formSubmit" type="submit" value="Process Payment" />
</form>
tom_cruz
  • 399
  • 1
  • 5
  • 13
  • If you're wanting to handle this with JS, so you can later handle the response, this answer should get you there: http://stackoverflow.com/questions/37026290/how-to-assign-data-from-html-formin-json-format-to-variable – NoobSter Feb 17 '17 at 08:38

2 Answers2

1

The action attribute should take care of it. Just adding the third party url in action will submit to that website without passing through your webserver.

  • it redirects to the page and shows again the same form with the needed details, this is what I am trying to bypass as I am already sending the data via POST for processing – tom_cruz Feb 17 '17 at 08:58
  • 1
    @tom_cruz — Then either you have client side JS getting in the way, or the other webserver is issuing a redirect back to yours. Forms will be submitted to wherever the action says they should be submitted. – Quentin Feb 17 '17 at 09:15
  • @tom_cruz check the network section (of chrome devtools or firebug) for the POST submit and check for 302/301/500 errors instead of 200. – Dhanesh Narvekar Feb 20 '17 at 06:37
0

Not sure if I understand you correctly but if I do it's very simple and it seems like you already have the solution in your example code. Forwarding a forms data to an endpoint not served by you is as easy as setting the action attribute to the correct url.

Pierre S
  • 29
  • 5