public function propFind($url, array $properties, $depth = 0)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->formatOutput = true;
        $root = $dom->createElementNS('DAV:', 'd:propfind');
        $prop = $dom->createElement('d:prop');

        foreach ($properties as $property) {
            list(
                $namespace,
                $elementName
            ) = \Sabre\Xml\Service::parseClarkNotation($property);

            if ('DAV:' === $namespace) {
                $element = $dom->createElement('d:'.$elementName);
            } else {
                $element = $dom->createElementNS($namespace, 'x:'.$elementName);
            }

            $prop->appendChild($element);
        }

        $dom->appendChild($root)->appendChild($prop);
        $body = $dom->saveXML();

        $url = $this->getAbsoluteUrl($url);

        $request = new HTTP\Request('PROPFIND', $url, [
            'Depth' => $depth,
            'Content-Type' => 'application/xml',
        ], $body);

        $response = $this->send($request);

        if ((int) $response->getStatus() >= 400) {
            throw new HTTP\ClientHttpException($response);
        }

        $result = $this->parseMultiStatus($response->getBodyAsString());

        // If depth was 0, we only return the top item
        if (0 === $depth) {
            reset($result);
            $result = current($result);

            return isset($result[200]) ? $result[200] : [];
        }

        $newResult = [];
        foreach ($result as $href => $statusList) {
            $newResult[$href] = isset($statusList[200]) ? $statusList[200] : [];
        }

        return $newResult;
    }
public function propFind($url, array $properties, $depth = 0)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->formatOutput = true;
        $root = $dom->createElementNS('DAV:', 'd:propfind');
        $prop = $dom->createElement('d:prop');

        foreach ($properties as $property) {
            list(
                $namespace,
                $elementName
            ) = \Sabre\Xml\Service::parseClarkNotation($property);

            if ('DAV:' === $namespace) {
                $element = $dom->createElement('d:'.$elementName);
            } else {
                $element = $dom->createElementNS($namespace, 'x:'.$elementName);
            }

            $prop->appendChild($element);
        }

        $dom->appendChild($root)->appendChild($prop);
        $body = $dom->saveXML();

        $url = $this->getAbsoluteUrl($url);

        $request = new HTTP\Request('PROPFIND', $url, [
            'Depth' => $depth,
            'Content-Type' => 'application/xml',
        ], $body);

        $response = $this->send($request);

        if ((int) $response->getStatus() >= 400) {
            throw new HTTP\ClientHttpException($response);
        }

        $result = $this->parseMultiStatus($response->getBodyAsString());

        // If depth was 0, we only return the top item
        if (0 === $depth) {
            reset($result);
            $result = current($result);

            return isset($result[200]) ? $result[200] : [];
        }

        $newResult = [];
        foreach ($result as $href => $statusList) {
            $newResult[$href] = isset($statusList[200]) ? $statusList[200] : [];
        }

        return $newResult;
    }
public function propFind ( $ url , array $ properties , $ depth = 0 ) { $ dom = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ dom -> formatOutput = true ; $ root = $ dom -> createElementNS ( 'DAV:' , 'd:propfind' ) ; $ prop = $ dom -> createElement ( 'd:prop' ) ; foreach ( $ properties as $ property ) { list ( $ namespace , $ elementName ) = \ Sabre \ Xml \ Service :: parseClarkNotation ( $ property ) ; if ( 'DAV:' === $ namespace ) { $ element = $ dom -> createElement ( 'd:' . $ elementName ) ; } else { $ element = $ dom -> createElementNS ( $ namespace , 'x:' . $ elementName ) ; } $ prop -> appendChild ( $ element ) ; } $ dom -> appendChild ( $ root ) -> appendChild ( $ prop ) ; $ body = $ dom -> saveXML ( ) ; $ url = $ this -> getAbsoluteUrl ( $ url ) ; $ request = new HTTP \ Request ( 'PROPFIND' , $ url , [ 'Depth' => $ depth , 'Content-Type' => 'application/xml' , ] , $ body ) ; $ response = $ this -> send ( $ request ) ; if ( ( int ) $ response -> getStatus ( ) >= 400 ) { throw new HTTP \ ClientHttpException ( $ response ) ; } $ result = $ this -> parseMultiStatus ( $ response -> getBodyAsString ( ) ) ; // If depth was 0, we only return the top item if ( 0 === $ depth ) { reset ( $ result ) ; $ result = current ( $ result ) ; return isset ( $ result [ 200 ] ) ? $ result [ 200 ] : [ ] ; } $ newResult = [ ] ; foreach ( $ result as $ href => $ statusList ) { $ newResult [ $ href ] = isset ( $ statusList [ 200 ] ) ? $ statusList [ 200 ] : [ ] ; } return $ newResult ; }
Does a PROPFIND request.

The list of requested properties must be specified as an array, in clark
notation.

The returned array will contain a list of filenames as keys, and
properties as values.

The properties array will contain the list of properties. Only properties
that are actually returned from the server (without error) will be
returned, anything else is discarded.

Depth should be either 0 or 1. A depth of 1 will cause a request to be
made to the server to also return all child resources.

@param string $url
@param array  $properties
@param int    $depth

@return array
Does a PROPFIND request .