-2

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?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Konkeles
  • 7
  • 1

4 Answers4

0

I think cURL should be enough, you can make HTTP(S) requests from one to the othe server.

0
  • let the PHP return a JSON object, best would be RESTfull.
  • let the java code make a REST call
Community
  • 1
  • 1
online Thomas
  • 8,864
  • 6
  • 44
  • 85
0

One answer: API. That's what APIs are intended for - communication between applications.

  1. Create endpoint in the JAVA app that acceps the data and does something with it.

  2. 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