开发者

Connect c++ application with an http calls?

is it possible to get the output of an c++ project as http request

eg:h开发者_开发百科ttp://localhost:8080 

just it need to output an xml or just any output...


Yes - this is typically some sort of CGI mechanism. Depending on the software you're using to run your webserver, if it supports CGI, it can be configured to invoke your program when certain URLs are requested. Your program's output to stdout would then be sent back to the HTTP client.

Be careful with this approach, especially if your application takes input from the user: bugs in your program can lead to security vulnerabilities if, for example, you have the possibility of a buffer overflow. Interpreted languages can sometimes offer some protection here.


You can use any executable as a CGI script (though they are usually perl or shell scripts).

Make your c++ executable print whatever you need to stdout (cout).

Here is a great into to CGI, and 4.2 tells you that you can make any executable run via CGI.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜