Skip to content

Commit

Permalink
Add documentation on using SSL parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccue committed Aug 10, 2013
1 parent 062a17e commit 51fe69b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/usage-advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Advanced Usage
==============

Secure Requests with SSL
------------------------
By default, HTTPS requests will use the most secure options available:

```php
$response = Requests::get('https://httpbin.org/');
```

Requests bundles certificates from the [Mozilla certificate authority list][],
which is the same list of root certificates used in most browsers. If you're
accessing sites with certificates from other CAs, or self-signed certificates,
you can point Requests to a custom CA list in PEM form (the same format
accepted by cURL and OpenSSL):

```php
$options = array(
'verify' => '/path/to/cacert.pem'
);
$response = Requests::get('https://httpbin.org/', array(), $options);
```

Alternatively, if you want to disable verification completely, this is possible
with `'verify' => false`, but note that this is extremely insecure and should be
avoided.

## Compatibility Note
Requests supports SSL across both cURL and fsockopen in a transparent manner.
Using fsockopen is slightly less secure, as the common name in certificates is
not checked. This is due to
[PHP lacking support for Subject Alternate Name][php-bug-47030]
(and OpenSSL also [lacking the low-level support][php-bug-55820] in PHP). If
these bugs are fixed, support for common name checking will be enabled by
default.

[Mozilla certificate authority list]: http://www.mozilla.org/projects/security/certs/
[php-bug-47030]: https://bugs.php.net/bug.php?id=47030
[php-bug-55820]:https://bugs.php.net/bug.php?id=55820

0 comments on commit 51fe69b

Please sign in to comment.