ZF-10302: Zend_Http_Client - Advanced Usage - HTTP Authentication (Digest)
Description
The documentation rather directly implies that one cannot use Zend_Http_Client with a DIGEST auth scheme.
http://framework.zend.com/manual/en/…
{quote} HTTP Authentication
Currently, Zend_Http_Client only supports basic HTTP authentication. This feature is utilized using the setAuth() method, or by specifying a username and a password in the URI. The setAuth() method... {quote}
This is rather misleading, if not completely a misnomer. As Zend_Http_Client fully supports the php's cURL library, one can simply configure Zend_Http_Client with the cURL Adapter (Zend_Http_Client_Adapter_Curl).
What is technically correct, is that the public method setAuth() of Zend_Http_Client only supports BASIC. Not the entire Zend_Http_Client utility - as implied.
This needs to be stated much more clearly. Development efforts are taking alternate platform / framework direction based on the sentence in question. Obviously, if the reader continues on, and is familiar w/ cURL in PHP, this fact can be discovered. However, the simple statement "Zend_Http_Client only supports basic HTTP authentication" stands out and can cause the reader to stop there - feeling the the statement is final.
example:
$adapter = new Zend_Http_Client_Adapter_Curl();
$adapter->setConfig(array(
'curloptions' => array(
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => "$username:$password"
)
));
$client = new Zend_Http_Client();
$client->setUri("http://www.example.com");
$client->setAdapter($adapter);
$response = $client->request();
This simple example of digest Authentication w/ the curl adapter should be included in the documentation.
Comments
No comments to display