Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | 1 | public function readFromUrl($url) |
|
13 | { |
||
14 | 1 | $urlHost = parse_url($url, PHP_URL_HOST); |
|
15 | |||
16 | 1 | $streamContext = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE))); |
|
17 | 1 | $stream = stream_socket_client("ssl://".$urlHost.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $streamContext); |
|
18 | 1 | $streamParams = stream_context_get_params($stream); |
|
19 | |||
20 | 1 | $certResource = $streamParams['options']['ssl']['peer_certificate']; |
|
21 | |||
22 | 1 | return new Certificate($this->certResourceToString($certResource)); |
|
23 | } |
||
24 | |||
47 |