I’m developing a little web server in C++, now I’m trying to implement PHP support for my WS, or better I’m trying to figure out how to implement that.
But I’ve got some doubts: for now I have the client’s request in a std::string, if it’s a static request there’s no problem: let’s find file and put in on socket buffer; if it’s a dynamic request(PHP only for now), of course I will need to call the interpreter(std::system() ??).
Now my mainly doubt is about forms, I get my POST request and I save form fields in a string, but now: How can I fill $_POST used in my php script and call the interpreter? I could put my fields string as argv by "php -f file.php "fields string" but ,of course, it’s awful.
I’m developing a little web server in C++, now I’m trying to implement PHP
Share
To pass the POST body, you basically pipe it in
For C and C++ you don’t want to use just
popen(), but also capture the output and stderr. So you need something like: how to control popen stdin, stdout, stderr redirection?