I'm writing very simple C code to see what I can do with the appWeb server via the cgi module. Here is the code:
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#include <stdio.h>
/* ------------------------------------------------------------------------ */
int main( int argc, char *argv[] )
{
char pszStr[1000];
char pszStr1[1000];
int iCnt;
char cChr;
// while ( iCnt < 50 )
// {
// cChr = getc(stdin);
// pszStr1[iCnt] = cChr;
// ++iCnt;
// }
// pszStr1[iCnt] = 0;
printf("Content-type: text/htmlnn");
printf("<html>n");
printf("<head>n");
printf("</head>n");
printf("<body>n");
printf("post: %s<br><br>",pszStr1);
iCnt = 0;
while ( iCnt < argc )
{
strcpy(pszStr,argv[iCnt]);
printf("%s<br>",pszStr);
++iCnt;
}
printf("</body>n");
printf("</html>n");
return(0);
}
/* --------------------------------------------------------------------------- */
It compiles fine and when doing a request method of "get" it displays the result in the web browser, but there are limits to the amount sent this way. What I really want to do is use a "post" and read the results from the "stdin", but it gives me a error in the browser that the page can't be displayed. Any thoughts would be appreciated.
