News
Abstract
ILE RPG CGI programming example
Content
You are in: IBM i Technology Updates > Web Integration on i > IBM HTTP Server for i > Introduction > CGI programming example > ILE RPG CGI programming example
This sample code is provided by IBM for illustrative purposes only. It has not been fully tested. It is provided as-is without any warranties of any kind, including but not limited to the implied warranties of merchantability and fitness for a particular purpose.
This program is a simple RPG program that demonstrates the HTTP server APIs for reading standard input, reading an environment variable and writing standard output. This is done using the HTTP Server APIs.
To install the example program, do the following:
|
The input for this program comes from CGI standard input or the environment variable QUERY_STRING. For an HTTP request method of POST, the input is read from standard input and for an HTTP request method of GET, the input is read from QUERY_STRING. For method POST, this program will only read 1024 characters. For method GET, the program will not read any input data when it exceeds 1024 characters.
The program reads data from standard input based on the Content_Length environment variable. The QtmhGetEnv System API is used to get the Content_Length and set the InDataLn variable used by the QtmhRdStdIn API. The data to be returned to the client is written to standard output using the QtmhWrStOut API. The data is returned as text/html.
Was this topic helpful?
Document Information
Modified date:
30 January 2020
UID
ibm11171270