Re: HTTP streams, status codes & WebDAV

From: Date: Mon, 18 Apr 2005 16:18:49 +0000
Subject: Re: HTTP streams, status codes & WebDAV
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-16007@lists.php.net to get a copy of this message
> Was hoping to use PHP streams API to query a WebDAV server, something > along the lines of.. > > $context = stream_context_create( > array( > 'http' => > array('method' => 'PROPFIND') > ) > ); > $f = fopen('http://localhost/WebDav/', 'r', > FALSE, $context); > > fpassthru($f); > fclose($f); > > but the streams API seems overly strict on status codes returned, a > succesful PROPFIND is meant to return a 207 status code, but the > HTTP stream wrapper isn't treating it as such, throwing an error, and > failing to open. Is this a bug? > Short Answer: http://pear.php.net/package/HTTP_WebDAV_Client Long Answer: Although the content is tossed out, you can see the status codes and any other headers in $http_response_header whether the http request returned a "valid" response code or not. That said, a context option to optionally accept additional response codes *may* be in order. -Sara

« previous php.internals (#16007) next »