How to build CRUD Java api connect to php server? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to build CRUD Java api connect to php server?

Build a web server using php and use java to write api (using 2 computers: 1 computer with php server, 1 computer using java api hooking to the server must perform CRUD on database and two of them can't write with framework)

16th Sep 2020, 8:17 AM
Tu Nguyen
Tu Nguyen - avatar
6 Answers
0
Not sure I understood question correctly, but I'll try. You need to know api of application running on php server. How does it accept requests. After that you can write web request using REST or SOAP or whatever.
16th Sep 2020, 10:22 AM
Aleksandrs
Aleksandrs - avatar
0
My teacher asked me to build a web server using php and use java to write api (using 2 computers: 1 computer with php server and 1 computer using java api hooking to the server must perform CRUD on database)
16th Sep 2020, 10:39 AM
Tu Nguyen
Tu Nguyen - avatar
0
You can use REST. For Java side, you can create Spring Boot application. You can then use RestTemplate to map objects to json and send requests to server. Of course php side should be able to process requests to write objects to db.
16th Sep 2020, 11:13 AM
Aleksandrs
Aleksandrs - avatar
0
Can you guide me in detail how to do that? Because I don't know anything about java and I am also quite weak in php.
16th Sep 2020, 11:23 AM
Tu Nguyen
Tu Nguyen - avatar
0
Why such a mad task for beginner? This is not trivial even for experienced developer. I don't think it is possible with no knowledge of Java and Spring, but you can read something like this: https://spring.io/guides/gs/consuming-rest
16th Sep 2020, 11:38 AM
Aleksandrs
Aleksandrs - avatar
0
So be it! This is a test used to evaluate the ability of my teacher.
16th Sep 2020, 11:48 AM
Tu Nguyen
Tu Nguyen - avatar