Your own stream handler

class VariableStream {
    var $position;
    var $varname;
    function stream_open($path, $mode, $options, &$opened_path) {
        $url = parse_url($path);
        $this->varname = $url["host"];
        $this->position = 0;
        return true;
    }
    function stream_read($count) {
        $ret = substr($GLOBALS[$this->varname], $this->position, $count);
        $this->position += strlen($ret);
        return $ret;
    }
    function stream_eof() {
        return $this->position >= strlen($GLOBALS[$this->varname]);
    }
    function url_stat() {
        return array();
    }
}
 
© copyright 2003 Bitflux GmbH