I have a server which I want two computers to communicate through - one sends a POST request, the other gets the posted contents, posts a result and the first one gets the posted contents. I know how to make a GET and POST request but how can I wait for a POST request to happen and get the posted contents?
Asked
Active
Viewed 56 times
0
-
what do you mean by the wait for POST request to complete? do you want it to be blocking the GET? otherwise, you can design the GET to throw a 404. – Naman Oct 10 '20 at 14:37
-
Yes, block the GET request until a POST request happens and then get what was posted by the POST request. – Loading BG Oct 10 '20 at 15:11
1 Answers
0
You'd need to start up a webserver to do so.
A simple way to get started is with something like Spark Framework.

rzwitserloot
- 85,357
- 5
- 51
- 72
-
-
-
I couldn't find an explanation on how to wait for a POST request to happen. – Loading BG Oct 10 '20 at 10:49
-
It depends on the web framework you use, so, which one are you using? – rzwitserloot Oct 10 '20 at 11:26
-
-
-
-
Apache web server. I followed this tutorial: https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress/2 – Loading BG Oct 10 '20 at 18:07
-
Okay, you need spark framework or figure out how to do this in PHP or anything else you can plug into apache. Apache by itself just serves files and cannot do this. – rzwitserloot Oct 10 '20 at 23:18