note 110158 added to function.stream-context-create
| From: | louis dot huppenbauer at gmail dot com | Date: | Tue, 25 Sep 2012 06:04:34 +0000 |
| Subject: | note 110158 added to function.stream-context-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191005@lists.php.net to get a copy of this message | ||
When using the https protocol you'll have to make sure to set the right context options to use
the full "power" of the ssl/tls encryption.
<?php
$url = 'https://secure.example.com/test/1';
$contextOptions = array(
'ssl' => array(
'verify_peer' => true,
'cafile' => __DIR__ . '/cacert.pem',
'verify_depth' => 5,
'CN_match' => 'secure.example.com'
)
);
$sslContext = stream_context_create($contextOptions);
$result = file_get_contents($url, NULL, $sslContext);
?>
More information about those context options can be found at http://php.net/manual/en/context.ssl.php
----
Server IP: 69.147.83.199
Probable Submitter: 91.199.186.2
----
Manual Page -- http://www.php.net/manual/en/function.stream-context-create.php
Edit -- https://master.php.net/note/edit/110158
Del: integrated -- https://master.php.net/note/delete/110158/integrated
Del: useless -- https://master.php.net/note/delete/110158/useless
Del: bad code -- https://master.php.net/note/delete/110158/bad+code
Del: spam -- https://master.php.net/note/delete/110158/spam
Del: non-english -- https://master.php.net/note/delete/110158/non-english
Del: in docs -- https://master.php.net/note/delete/110158/in+docs
Del: other reasons-- https://master.php.net/note/delete/110158
Reject -- https://master.php.net/note/reject/110158
Search -- https://master.php.net/manage/user-notes.php