-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation on using SSL parameters
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |