Apache Specific Functions

Apache Specific Functions

apache_lookup_uri

Name

apache_lookup_uri — Perform a partial request for the specified URI and return all info about it

Description

class apache_lookup_uri(string filename);

This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource and returns this information in a class. The properties of the returned class are:

status the_request status_line method content_type handler

uri filename path_info args boundary no_cache

no_local_copy allowed send_bodyct bytes_sent byterange clength unparsed_uri mtime request_time

apache_note

Name

apache_note — Get and set apache request notes

Description

string apache_note(string note_name, string [note_value]);

apache_note is an Apache-specific function which gets and sets values in a request's notes table. If called with one argument, it returns the current value of note note_name. If called with two arguments, it sets the value of note note_name to note_value and returns the previous value of note note_name.

getallheaders

Name

getallheaders — Fetch all HTTP request headers

Description

array getallheaders(void);

This function returns an associative array of all the HTTP headers in the current request.

Example 1. GetAllHeaders() Example

$headers = getallheaders();

while (list($header, $value) = each($headers)) { echo "$header: $value<br>\n";

}

This example will display all the request headers for the current request.

GetAllHeaders is currently only supported when PHP runs as an Apache module.

virtual

Name

virtual — Perform an Apache sub-request

Description

int virtual(string filename);

virtual is an Apache-specific function which is equivalent to <!--#include virtual...--> in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header. For PHP files, you should use include or require.