I l@ve RuBoard Previous Section Next Section

virtual

int virtual(string URI) 

Performs an Apache subrequest to parse and include a file.

Returns:

TRUE if successful; FALSE on error

Description:

This function enables you to perform an Apache subrequest. It performs the same function that mod_include allows you to perform (<!--#include virtual...-->) , but you can access the feature from within PHP scripts. This is useful if you want to include the output of a CGI script within your PHP file, for example. You can't use virtual() on PHP files; use include() instead.

Version:

Existing since version 3.0

Warning:

In versions prior to 3.0.13, it was possible to use virtual() on PHP files under some circumstances.


Example:

Include the output of a Perl CGI script
$script = "/cgi-bin/script.pl"; 
if (!@virtual($script)) {
    // The @ prevents a PHP error from occurring if the function call fails 
    print("ERROR - Unable to include file '$script'!<br />\n"); 
} 
    I l@ve RuBoard Previous Section Next Section