(FW >= 1.0)

fopen - Open a file or input stream


int fopen( string $filename, int $flags )

This will attempt to open a file or stream for reading or writing.  If a path is omitted, the current directory will be used to search for the file.  Relative paths are supported.



Filename or complete path to file.  Two special file names will open specific streams instead:
php://stdin - this will open a stream that will accept characters from a telnet console, allowing for interactive applications responding to keystrokes
php://stdout - this will send output characters to the standard device, such as telnet console


The following strings are supported:
"r" - open file in read only mode
"w" - open file in write mode (it will overwrite the file)
"a" - open file in append mode, it will open the file and move to the end of the file

Return Value

fopen() returns a file index which may be used together with the other file functions (such as fgets(), fwrite(), fclose(), and feof()). If the call fails, it will return 0.


$fp = fopen("/index.cgi","r");
if (!$fp) {
    print("File open failed\n");
} else {