Back to product page

CGIExecute method


Executes external CGI program as the response.

Syntax

  • Basic
object.CGIExecute (FullPath, [ScriptName], [ScriptPath])
The CGIExecute(object,FullPath,ScriptName,ScriptPath) syntax has these parts:
objectAn expression evaluating to an object of type WebResponse
FullPathA String value. Full path to CGI executable, including any command-line arguments it may need.
ScriptNameOptional. A Variant value. Name of executed script as seen by the client.
ScriptPathOptional. A Variant value. Full path to executed script, as seen by the server.

Remarks

CGIExecute method will call external program and let it execute the request, and provide proper response that will be sent to the client. You need only to provide path to the CGI executable, together with any arguments it may need.

wodWebServer will set environment variables needed for the CGI, will redirect standard input/output handles, wait for CGI response, populate Response.Body with it, and finally call Response.Send method to deliver it to the client.

CGI can be any executable running as console application. You can use PHP, PERL, C++ or any other language to create CGI scripts.

There are two events correlated to CGI scripts: CGIStart that is fired just before script is to be executed (allowing you to change environment for the CGI script), and CGIStop (allowing you to change response before it is sent to the client)

WARNING: Before using this method you should set Response.Filename property to empty string "", otherwise your CGI could overwrite your HTML resources stored on the disk. This will typically happen if you set DocumentRoot property.

Platforms

Windows