summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst')
-rw-r--r--vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst b/vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst
new file mode 100644
index 0000000..66d4a01
--- /dev/null
+++ b/vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst
@@ -0,0 +1,32 @@
+==========================
+cURL authentication plugin
+==========================
+
+.. warning::
+
+ The CurlAuthPlugin is deprecated. You should use the `auth` parameter of a client to add authorization headers to
+ every request created by a client.
+
+ .. code-block:: php
+
+ $client->setDefaultOption('auth', array('username', 'password', 'Basic|Digest|NTLM|Any'));
+
+If your web service client requires basic authorization, then you can use the CurlAuthPlugin to easily add an
+Authorization header to each request sent by the client.
+
+.. code-block:: php
+
+ use Guzzle\Http\Client;
+ use Guzzle\Plugin\CurlAuth\CurlAuthPlugin;
+
+ $client = new Client('http://www.test.com/');
+
+ // Add the auth plugin to the client object
+ $authPlugin = new CurlAuthPlugin('username', 'password');
+ $client->addSubscriber($authPlugin);
+
+ $response = $client->get('projects/1/people')->send();
+ $xml = new SimpleXMLElement($response->getBody(true));
+ foreach ($xml->person as $person) {
+ echo $person->email . "\n";
+ }