Submit the form at remote server from own server

Looking for solution to the situation below.

1.      A form on the remote server accepts employee id (emp_id) and returns the employee details on submit.

2.      In my application I have the textbox where user enters the emp_id and when clicks submit,it should programmatically submit the remote server form with parameters emp_id entered at my app page.

3.      I am looking for the way to call the remote server form and pre populate emp_id and submit it to the remote server. The response I get form remote server will be captured and shown to the user.

4.      I have tried to post the emp_id to the action of the remote server form,but that could not be done as they blocked such access,so only option I left with is to fill their form which I decided to do programmatically with ajax.I can't render remote form directly as there are many more fields in that form along with emp_id.

Please help me to solve this.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
fill their form which I decided to do programmatically with ajax.
It will be easier if you use PHP.  This is a research project, not a question with any succinct answer, and since we do not have the URL, we cannot see what you might need to do with the HTML, but here is the general strategy you need to use.

1. GET PERMISSION TO ACCESS THEIR DATA THIS WAY.  They are the publishers and they own the data.  If they want you to access it in an automated fashion, they will give permission.  Get this in writing so there can be no question about it.

2. Read the HTML document that contains the remote server form.

3. Parse the HTML to isolate all of the data elements that must be returned to make the HTTP request to the remote server.

4. Build the raw HTTP query string.

5. Use cURL to make the HTTP POST request to the remote server.  Your script must act like a well-behaved web browser, accepting and returning cookies, and following redirects.

6. Read the response from the remote server.

7. Parse the HTML to isolate the data elements you want from the response document.

In my experience, it can take the better part of a day to get something like this working.  And that's after you get permission from the publisher!  Best of luck with the project, ~Ray

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.