function delete($path) {
        $this->_path = $this->translate_uri($path);
        $this->header_unset();
        $this->create_basic_request('DELETE');
        /* $this->header_add('Content-Length: 0'); */
        $this->header_add('');
        $this->send_request();
        $this->get_respond();
        $response = $this->process_respond();

        // validate the response ...
        // check http-version
        if ($response['status']['http-version'] == 'HTTP/1.1' ||
            $response['status']['http-version'] == 'HTTP/1.0') {
                // seems to be http ... proceed
                // We expect a 207 Multi-Status status code
                // print 'http ok<br>';

                switch ($response['status']['status-code']) {
                case 207:
                    // collection was NOT deleted... see xml response for reason...
                    // next there should be a Content-Type: text/xml; charset="utf-8" header line
                    if (strcmp($response['header']['Content-Type'], 'text/xml; charset="utf-8"') == 0) {
                        // ok let's get the content of the xml stuff
                        $this->_parser = xml_parser_create_ns();
                        $this->_parserid = (int) $this->_parser;
                        // forget old data...
                        unset($this->_delete[$this->_parserid]);
                        unset($this->_xmltree[$this->_parserid]);
                        xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
                        xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
                        xml_set_object($this->_parser, $this);
                        xml_set_element_handler($this->_parser, "_delete_startElement", "_endElement");
                        xml_set_character_data_handler($this->_parser, "_delete_cdata");

                        if (!xml_parse($this->_parser, $response['body'])) {
                            die(sprintf("XML error: %s at line %d",
                                xml_error_string(xml_get_error_code($this->_parser)),
                                xml_get_current_line_number($this->_parser)));
                        }

                        print "<br>";

                        // Free resources
                        xml_parser_free($this->_parser);
                        $this->_delete[$this->_parserid]['status'] = $response['status']['status-code'];
                        return $this->_delete[$this->_parserid];

                    } else {
                        print 'Missing Content-Type: text/xml header in response.<br>';
                    }
                    return false;

                default:
                    // collection or file was successfully deleted
                    $this->_delete['status'] = $response['status']['status-code'];
                    return $this->_delete;


                }
            }

    }
function delete($path) {
        $this->_path = $this->translate_uri($path);
        $this->header_unset();
        $this->create_basic_request('DELETE');
        /* $this->header_add('Content-Length: 0'); */
        $this->header_add('');
        $this->send_request();
        $this->get_respond();
        $response = $this->process_respond();

        // validate the response ...
        // check http-version
        if ($response['status']['http-version'] == 'HTTP/1.1' ||
            $response['status']['http-version'] == 'HTTP/1.0') {
                // seems to be http ... proceed
                // We expect a 207 Multi-Status status code
                // print 'http ok<br>';

                switch ($response['status']['status-code']) {
                case 207:
                    // collection was NOT deleted... see xml response for reason...
                    // next there should be a Content-Type: text/xml; charset="utf-8" header line
                    if (strcmp($response['header']['Content-Type'], 'text/xml; charset="utf-8"') == 0) {
                        // ok let's get the content of the xml stuff
                        $this->_parser = xml_parser_create_ns();
                        $this->_parserid = (int) $this->_parser;
                        // forget old data...
                        unset($this->_delete[$this->_parserid]);
                        unset($this->_xmltree[$this->_parserid]);
                        xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
                        xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
                        xml_set_object($this->_parser, $this);
                        xml_set_element_handler($this->_parser, "_delete_startElement", "_endElement");
                        xml_set_character_data_handler($this->_parser, "_delete_cdata");

                        if (!xml_parse($this->_parser, $response['body'])) {
                            die(sprintf("XML error: %s at line %d",
                                xml_error_string(xml_get_error_code($this->_parser)),
                                xml_get_current_line_number($this->_parser)));
                        }

                        print "<br>";

                        // Free resources
                        xml_parser_free($this->_parser);
                        $this->_delete[$this->_parserid]['status'] = $response['status']['status-code'];
                        return $this->_delete[$this->_parserid];

                    } else {
                        print 'Missing Content-Type: text/xml header in response.<br>';
                    }
                    return false;

                default:
                    // collection or file was successfully deleted
                    $this->_delete['status'] = $response['status']['status-code'];
                    return $this->_delete;


                }
            }

    }
function delete ( $ path ) { $ this -> _path = $ this -> translate_uri ( $ path ) ; $ this -> header_unset ( ) ; $ this -> create_basic_request ( 'DELETE' ) ; /* $this->header_add('Content-Length: 0'); */ $ this -> header_add ( '' ) ; $ this -> send_request ( ) ; $ this -> get_respond ( ) ; $ response = $ this -> process_respond ( ) ; // validate the response ... // check http-version if ( $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.1' || $ response [ 'status' ] [ 'http-version' ] == 'HTTP/1.0' ) { // seems to be http ... proceed // We expect a 207 Multi-Status status code // print 'http ok<br>'; switch ( $ response [ 'status' ] [ 'status-code' ] ) { case 207 : // collection was NOT deleted... see xml response for reason... // next there should be a Content-Type: text/xml; charset="utf-8" header line if ( strcmp ( $ response [ 'header' ] [ 'Content-Type' ] , 'text/xml; charset="utf-8"' ) == 0 ) { // ok let's get the content of the xml stuff $ this -> _parser = xml_parser_create_ns ( ) ; $ this -> _parserid = ( int ) $ this -> _parser ; // forget old data... unset ( $ this -> _delete [ $ this -> _parserid ] ) ; unset ( $ this -> _xmltree [ $ this -> _parserid ] ) ; xml_parser_set_option ( $ this -> _parser , XML_OPTION_SKIP_WHITE , 0 ) ; xml_parser_set_option ( $ this -> _parser , XML_OPTION_CASE_FOLDING , 0 ) ; xml_set_object ( $ this -> _parser , $ this ) ; xml_set_element_handler ( $ this -> _parser , "_delete_startElement" , "_endElement" ) ; xml_set_character_data_handler ( $ this -> _parser , "_delete_cdata" ) ; if ( ! xml_parse ( $ this -> _parser , $ response [ 'body' ] ) ) { die ( sprintf ( "XML error: %s at line %d" , xml_error_string ( xml_get_error_code ( $ this -> _parser ) ) , xml_get_current_line_number ( $ this -> _parser ) ) ) ; } print "<br>" ; // Free resources xml_parser_free ( $ this -> _parser ) ; $ this -> _delete [ $ this -> _parserid ] [ 'status' ] = $ response [ 'status' ] [ 'status-code' ] ; return $ this -> _delete [ $ this -> _parserid ] ; } else { print 'Missing Content-Type: text/xml header in response.<br>' ; } return false ; default : // collection or file was successfully deleted $ this -> _delete [ 'status' ] = $ response [ 'status' ] [ 'status-code' ] ; return $ this -> _delete ; } } }
Public method delete

deletes a collection/directory on a webdav server
@param string path
@return int status code (look at rfc 2518). false on error.
Public method delete