-3

How can I (if it's possible) send information from a form to two separate servers? (One being a Windows server)

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • 2
    Wow. This question... You have provided no useful information; there is no conceivable way anyone could hope to answer it. – Kirk Woll Nov 08 '11 at 01:37
  • This is pretty vague. Try asking a more concrete question, perhaps one that includes source code. – sarnold Nov 08 '11 at 01:37
  • I'm assuming you're talking about a CGI program written in some console language like C? Generally you can copy the form POST data and resend it through a socket that you open to another server, as captured via your CGI program. Not sure if this is what you're talking about, though. – William the Coderer Nov 08 '11 at 01:43
  • 1
    @William, the `asp` tag makes me *strongly* suspect the OP is not writing a CGI program written in C. – Kirk Woll Nov 08 '11 at 01:44
  • Are you talking about a web page making a single POST request to two different resources on two different servers? – David Nov 08 '11 at 01:48

2 Answers2

0

Generate an XML file, then create asp and I guess a PHP file to read the data and store them (if they dont exist already) to your database. On a Linux server, you can set up a cron job to automatically run the code every often.

apaderno
  • 28,547
  • 16
  • 75
  • 90
0

It sounds like you're asking if a web page form can make a single POST request to two different resources on two different servers. (If that's not the case then please say so in a comment so I can delete this answer.)

Using a simple form POST, no. However, you do have a couple of options available to you...

You could use JavaScript on the page to manually send the POST to the two different resources. In this case you probably wouldn't have an action on the form element at all. (If you even need a form element, which isn't entirely necessary in this case.) The JavaScript code would just attach a handler to the button's click event, build the request from the form elements, and send the POST.

Since it's going to two different resources, you'll want it to happen asynchronously (that is, without reloading the page) and then handle the response and any user notification/interaction from within the JavaScript code. jQuery provides handy functions for making this pretty easy.

Another option would be to have the page post as you otherwise normally would and create the second POST from the server-side code. Think of it like daisy-chaining the requests. The page sends its request to Server A, which sends a duplicate request to Server B. The downside is that Server B would think that the request came from Server A. Without more information about what specifically you need to achieve, this may prove to be a difficult limitation.

Based on your tags, I assume you're using classic ASP as your server-side language. (If this is incorrect, please elaborate and/or update the tags.) If that's the case, then you can craft a POST web request in code from Server A to send to Server B.

Personally I prefer the first solution. But I don't have enough information about your particular situation to say for certain what would be the best approach.

Community
  • 1
  • 1
David
  • 208,112
  • 36
  • 198
  • 279