05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

un under IIS, you will need to reimplement that functionality. Following are the<br />

Apache-specific functions and some solutions for replacing them:<br />

getallheaders( )<br />

Fetch all HTTP request headers. You can access the HTTP request headers via<br />

the predefined variable $HTTP_ENV_VARS instead of using this function for any web<br />

server, including Apache.<br />

virtual( )<br />

Perform an Apache subrequest. This function allows you to include a URI from<br />

the local web server in the <strong>PHP</strong> script. If the retrieved text includes a <strong>PHP</strong> script,<br />

that script will become part of your current script.<br />

apache_lookup_uri( )<br />

Perform a partial request for the specified URI and return all information about<br />

it. This function requests Apache to provide information about a URI. No conversion<br />

is available for IIS.<br />

apache_note( )<br />

Get and set Apache request notes. This function is used for communication<br />

between Apache plug-ins. No conversion is available for IIS.<br />

ascii2ebcdic( ) and ebcdic2ascii( )<br />

These functions translate strings to and from ASCII and EBCDIC. Apache must<br />

be compiled with EBCDIC support for these functions to work. <strong>PHP</strong> provides no<br />

other means of converting EBCDIC strings. Microsoft provides a C-based API to<br />

handle EBCDIC translations.<br />

There is also a set of IIS-specific functions, though its purpose is primarily for management<br />

of IIS.<br />

Remote Files<br />

Under Unix, <strong>PHP</strong> is able to retrieve remote files via HTTP or FTP for inclusion in<br />

your script via the require( ) and include( ) functions. These functions are not available<br />

under Windows. Instead, you must write your own subroutine to fetch the<br />

remote file, save it to a temporary local file, and then include that file, as shown in<br />

Example 15-1.<br />

Example 15-1. Including a remote file with <strong>PHP</strong> on Windows<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!