Perspiration... This experience is intended for beginners. My understanding of php is not deep enough, so sometimes I turn to a handy development tool for cgi when I encounter a problem that cannot be solved by using php for a while, and the security and stability are also very easy to improve, the exe program is only dozens of kb, and the speed is still acceptable. if it is made into a dll, the speed is also very fast for C and C ++.
Perspiration... This experience is intended for beginners.
My understanding of php is not deep enough, so sometimes I turn to a handy development tool for cgi when I encounter a problem that cannot be solved by using php for a while, and the security and stability are also very easy to improve, the exe program is only dozens of kb, and the speed is still acceptable. if it is made into a dll, the speed is also very fast.
1. there are two ways to obtain incoming data based on different page request methods:
1. if The POST method is used:
For example, a text box named tName exists in the submission form.
In C ++ Builder, you should obtain the following information:
AnsiString s = Request-> ContentFields-> Values [AnsiString ("tName")];
Response-> Content = s;
Response-> SendResponse ();
2. if the GET method is used:
Example: URL request: http: // localhost/cgi-bin/xxx.exe/reg? Abc= 123
In C ++ Builder, you should obtain the following information:
AnsiString s = Request-> QueryFields-> Values [AnsiString ("abc")];
Response-> Content = s;
Response-> SendResponse ();
Or prj. cgi can be used normally, and the security is virtually improved.
3. cgi developed using c ++ builder can respond to multiple different requests and use path identifiers to differentiate them. These paths are virtual and actually do not exist, it only exists in the current executable file, for example:
Http: // localhost/cgi-bin/prj.exe/photo? Id = 1
Http: // localhost/cgi-bin/prj.exe/document? Id = 2
...
This feature can be used to implement multiple processing tasks in one cgi. a small exe file basically finishes all the work.