cgi-bin

How to retrieve form “POST” data via cgi-bin program written in C

。_饼干妹妹 提交于 2019-11-26 21:36:05
问题 I am trying to retrieve POST data from html form using program written in C. At the moment I am using: char *formdata = getenv("QUERY_STRING"); if(formdata == NULL) /* no data retrieved */ This seems to be working fine with form "GET" method but not with "POST" method. How do I retrieve POST data? 回答1: POST data is appended to the request header, after a double newline. In a CGI-BIN environment, you read it from STDIN. Be warned that the server IS NOT REQUIRED to send you an EOF character (or