Methods |
public
|
__construct(array $settings)
Constructor.
Constructor.
Settings are provided through the 'settings' argument. The following
settings are supported:
- baseUri
- userName (optional)
- password (optional)
- proxy (optional)
- authType (optional)
- encoding (optional)
authType must be a bitmap, using self::AUTH_BASIC, self::AUTH_DIGEST
and self::AUTH_NTLM. If you know which authentication method will be
used, it's recommended to set it, as it will save a great deal of
requests to 'discover' this information.
Encoding is a bitmap with one of the ENCODING constants.
Overrides
|
#
|
public
|
propFind(string $url, array $properties, int $depth = 0): array
Does a PROPFIND request.
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.
|
#
|
public
|
propPatch(string $url, array $properties): bool
Updates a list of properties on the server.
Updates a list of properties on the server.
The list of properties must have clark-notation properties for the keys,
and the actual (string) value for the value. If the value is null, an
attempt is made to delete the property.
|
#
|
public
|
options(): array
Performs an HTTP options request.
Performs an HTTP options request.
This method returns all the features from the 'DAV:' header as an array.
If there was no DAV header, or no contents this method will return an
empty array.
|
#
|
public
|
request(string $method, string $url = '', string|resource|null $body = null, array $headers = []): array
Performs an actual HTTP request, and returns the result.
Performs an actual HTTP request, and returns the result.
If the specified url is relative, it will be expanded based on the base
url.
The returned array contains 3 keys:
- body - the response body
- httpCode - a HTTP code (200, 404, etc)
- headers - a list of response http headers. The header names have
been lowercased.
For large uploads, it's highly recommended to specify body as a stream
resource. You can easily do this by simply passing the result of
fopen(..., 'r').
This method will throw an exception if an HTTP error was received. Any
HTTP status code above 399 is considered an error.
Note that it is no longer recommended to use this method, use the send()
method instead.
Overriden by
|
#
|
public
|
getAbsoluteUrl(string $url): string
Returns the full url based on the given url (which may be relative). All
urls are expanded based on the base url as…
Returns the full url based on the given url (which may be relative). All
urls are expanded based on the base url as given by the server.
|
#
|
public
|
parseMultiStatus(string $body): array
Parses a WebDAV multistatus response body.
Parses a WebDAV multistatus response body.
This method returns an array with the following structure
[
'url/to/resource' => [
'200' => [
'{DAV:}property1' => 'value1',
'{DAV:}property2' => 'value2',
],
'404' => [
'{DAV:}property1' => null,
'{DAV:}property2' => null,
],
],
'url/to/resource2' => [
.. etc ..
]
]
Parameters
Overriden by
|
#
|
Constants |
public
|
AUTH_BASIC = 1
Basic authentication.
|
#
|
public
|
AUTH_DIGEST = 2
Digest authentication.
|
#
|
public
|
AUTH_NTLM = 4
NTLM authentication.
|
#
|
public
|
ENCODING_IDENTITY = 1
Identity encoding, which basically does not nothing.
Identity encoding, which basically does not nothing.
|
#
|
public
|
ENCODING_DEFLATE = 2
Deflate encoding.
|
#
|
public
|
ENCODING_GZIP = 4
Gzip encoding.
|
#
|
public
|
ENCODING_ALL = 7
Sends all encoding headers.
Sends all encoding headers.
|
#
|