note 110476 added to httprequest.setssloptions
| From: | coder.ua | Date: | Thu, 25 Oct 2012 18:11:13 +0000 |
| Subject: | note 110476 added to httprequest.setssloptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191547@lists.php.net to get a copy of this message | ||
Array with ssl options have next format.
Also, I have made the appropriate with cURL options.
<?php
$options = array(
// The name of a file containing a PEM formatted certificate.
'cert' => '', // CURLOPT_SSLCERT
// The format of the certificate. Supported formats are "PEM" (default),
"DER", and "ENG".
'certtype' => '', // CURLOPT_SSLCERTTYPE
// The password required to use the 'cert' certificate.
'certpasswd' => '', // CURLOPT_SSLCERTPASSWD
// The name of a file containing a private SSL key.
'key' => '', // CURLOPT_SSLKEY,
// The key type of the private SSL key specified in 'key'. Supported key types are
"PEM" (default), "DER", and "ENG"
'keytype' => '', // CURLOPT_SSLKEYTYPE
// The secret password needed to use the private SSL key specified in 'key'
'keypasswd' => '', // CURLOPT_SSLKEYPASSWD
// The identifier for the crypto engine of the private SSL key specified in 'key'
'engine' => '', // CURLOPT_SSLENGINE
// The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although
in some cases this must be set manually
'version' => 2, // CURLOPT_SSLVERSION
// FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to
verify against can be specified with the 'cainfo' option or a certificate directory can be
specified with the 'capath' option
'verifypeer' => FALSE, // CURLOPT_SSL_VERIFYPEER
// 1 to check the existence of a common name in the SSL peer certificate. 2 to check the
existence of a common name and also verify that it matches the hostname provided. In production
environments the value of this option should be kept at 2 (default value).
'verifyhost' => 1, // CURLOPT_SSL_VERIFYHOST
// A list of ciphers to use for SSL. For example, RC4-SHA and TLSv1 are valid cipher lists.
'cipher_list' => '', // CURLOPT_SSL_CIPHER_LIST
// The name of a file holding one or more certificates to verify the peer with. This only makes
sense when used in combination with 'verifypeer'.
'cainfo' => '', // CURLOPT_CAINFO
// A directory that holds multiple CA certificates. Use this option alongside
'verifypeer'
'capath' => '', // CURLOPT_CAPATH
// A filename to be used to seed the random number generator for SSL
'random_file' => '', // CURLOPT_RANDOM_FILE
// Like 'random_file', except a filename to an Entropy Gathering Daemon socket
'egdsocket' => '', // CURLOPT_EGDSOCKET
);
?>
Small example:
<?php
$request = new HttpRequest('http://example.com/');
$ssl_options = array('verifypeer' => TRUE,
'verifyhost' => 1,
'cert' => '/cert/mycert.pem',
'certtype' => 'PEM',
'cainfo' => '/cert/ca.crt',
'version' => 3,
'certpasswd' => 'pazzword'
);
$request->setSslOptions($ssl_options);
var_dump($request->getSslOptions());
/*
* RESULT
Array
(
[verifypeer] => 1
[verifyhost] => 1
[cert] => /cert/mycert.pem
[certtype] => PEM
[cainfo] => /cert/ca.crt
[version] => 3
[certpasswd] => pazzword
)
*/
?>
----
Server IP: 69.147.83.199
Probable Submitter: 91.124.49.161
----
Manual Page -- http://www.php.net/manual/en/httprequest.setssloptions.php
Edit -- https://master.php.net/note/edit/110476
Del: integrated -- https://master.php.net/note/delete/110476/integrated
Del: useless -- https://master.php.net/note/delete/110476/useless
Del: bad code -- https://master.php.net/note/delete/110476/bad+code
Del: spam -- https://master.php.net/note/delete/110476/spam
Del: non-english -- https://master.php.net/note/delete/110476/non-english
Del: in docs -- https://master.php.net/note/delete/110476/in+docs
Del: other reasons-- https://master.php.net/note/delete/110476
Reject -- https://master.php.net/note/reject/110476
Search -- https://master.php.net/manage/user-notes.php