I have two WEB applications based on two different servers. How I can pass data from the PHP web form, which consists of 5-10 fields, to Java application(Struts2, Spring2) in the most elegant and safe way?
Asked
Active
Viewed 158 times
-2
-
you can same DB or you can use REST API system to pass value from one site to an other site – Shiv Singh Jan 15 '16 at 10:45
-
Web form? Why not to submit to your java app? – Aleksandr M Jan 15 '16 at 11:18
4 Answers
0
I think cURL should be enough, you can make HTTP(S) requests from one to the othe server.

nullexception
- 78
- 6
0
One answer: API. That's what APIs are intended for - communication between applications.
Create endpoint in the JAVA app that acceps the data and does something with it.
In PHP after recieving the data from form make a call to the JAVA app endpoint and send the data there.
For security you may want to use some data encription using oauth (that is if you data requires that kind of security).

Auris
- 1,309
- 1
- 9
- 18
0
You have created an API which will return JSON array. Call that API from java application and get JSON, decode JSON and use that.

Tobb
- 11,850
- 6
- 52
- 77

Shoaib Rehan
- 526
- 6
- 16