The CGI (gb.web) class contains methods for accessing environment variables that you can use in your CGI projects.
The CGI class has only these four methods:
Method | ReturnType | Description |
---|---|---|
Encode ( Path As String ) | String | Encodes a URL into the Application/x-www-form-urlencoded format. |
Decode ( Path As String ) | String | Decodes a URL from the Application/x-www-form-urlencoded-Format. |
FormatDate ( dDate As Date ) | String | Formats a date into the RFC-822 date format. The function value is of data type 'String'. |
Error ( Text As String ) | String | The method tries to insert an error message into the HTML output. The result of this method depends on what has already been sent to the client. |
Table 24.6.1.1 : Methods of the CGI class.
Notes:
Print CGI.Encode("http://www.gambas-buch.de/dw/doku.php?id=k18:start") Print CGI.Decode("http%3A%2F%2Fwww.gambas-buch.de%2Fdw%2Fdoku.php%3Fid%3Dk18%3Astart") Print CGI.FormatDate(Now) Print CGI.Error("Das ging schief...!")
Outputs in the console of the Gambas IDE:
http%3A%2F%2Fwww.gambas-buch.de%2Fdw%2Fdoku.php%3Fid%3Dk18%3Astart http://www.gambas-buch.de/dw/doku.php?id=k18:start Sat, 19 Jul 2014 18:36:13 GMT <h1>Error in CGI script</h1><pre>Das ging schief...!</pre>
However, you can also use the CGI class like an array to read ( CGI[..] ) or set ( CGI[..] = … ) the value of environment variables - as shown in the following examples:
For an overview of CGI environment variables, see the link:
http://de.selfhtml.org/servercgi/cgi/umgebungsvariablen.htm