提交表单商店响应

I have a form the lies on a server I do not have control of. Lets call it form1. I know the POST requirements of form1. I am creating my own form to submit data to that form1. Lets call that one form2. Form1 returns a ticket number, I need to store that ticket number into a department database, along with other information (that part I am ok with). So I need form2(my form) to submit data to form1(ITs form) and store the response from form1 into our department database.

What is the easiest way to do this? I have searched online for hours, and have come up empty. I went from javascript to iFrame to Ajax to jQuery. And I am just lost now.

My server is a PHP server, theirs is a ASP server.

Thanks in advance.

This is not a client-side operation, it is a server side operation. There is no need for "form2". You want to use curl for this. Something like this:

// Set up a connection to the target of form1 (this is the "action" attribute of form1)
$curl_connection = curl_init('http://hostname.com/form1.asp');

// Set up so options -- connection timout, store to string, follow redirects
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);

// Set the post fields, this is just like a query string and contains the contents of form1 fields
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, "field1=value1&field2=value2");

// Run the query and capture the results
$data = curl_exec($curl_connection);
curl_close($curl_connection);

// At this point $data should contain the ticket number
var_dump($data);