DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 8.11 Including the Output of a CGI Program

Problem

You want to have the output of a CGI program appear within the body of an existing HTML document.

Solution

Use SSIs by adding a line such as the following to the document (which must be enabled for SSI parsing):

<--#include virtual="/cgi-bin/content.cgi" -->

Discussion

The SSI #include directive, in addition to being able to include a plain file, can also include other dynamic content, such as CGI programs, other SSI documents, or content generated by any other method.

The #exec SSI directive may also be used to produce this effect, but for a variety of historical and security-related reasons, its use is deprecated. The #include directive is the preferred way to produce this effect.

Note that Options IncludeNoExec, in addition to disabling the #exec SSI directive, also forbids the inclusion of CGI programs using the #include virtual syntax. Thus, this method cannot be used to circumvent the restriction.

See Also

    [ Team LiB ] Previous Section Next Section