I have a website with forms, controls, etc. User inputs should be sent to a C++ program running on the same PC as the webserver (busybox httpd). On the other hand results of the C++ program should be sent back and displayed on the website. I am a bit lost where to start and what to Google. Can someone point me into the right direction?
Asked
Active
Viewed 923 times
2
-
Data entered into a web page would be sent from the browser to the web server, and data sent to a browser comes from the web server. So a more accurate description of what you want is to set up two-way communication between your web server and your program. (The details of how the web page collects data are irrelevant.) How to do that depends on what your web server supports, and that information is missing from your question. – JaMiT Jan 26 '20 at 22:45
-
Sorry, it's busybox httpd – Reto Jan 27 '20 at 16:28
1 Answers
2
You need to create a HTTP server which will receive HTTP requests and send HTTP responses. The requests are sent by your browser whenever you enter a web page, send a form, etc...
In C++ you have different libraries that do this without having to do it by yourself which is an existing question on stackoverflow. I recommend CURL as I had good experiences with it, but other libraries must do well too.
If you have to entirely make the HTTP server yourself, you can look at the example of Wikipedia (they also provide explanation about the Hypertext Transfer Protocol).

Nathanael Demacon
- 1,169
- 7
- 19
-
Thanks. Just to clarify. The website is already running on a webserver on that PC. Is this enough or is an HTTP server something different? – Reto Jan 26 '20 at 21:19
-
It's basically the same thing but you'll need to do your own server in order to receive HTTP requests and do logic around it. Which *webserver* are you using? – Nathanael Demacon Jan 26 '20 at 22:29
-
-
Ok so you'll need to make a HTTP server in order to receive HTTP requests. Busybox just serve statically the files you want (or run PHP maybe?). – Nathanael Demacon Jan 27 '20 at 16:41