How to check if there is an https wrapper available in PHP

1 Answer

0 votes
$w = stream_get_wrappers();
echo 'openssl: ',  extension_loaded ('openssl') ? 'yes':'no', "<br />";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "<br />";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "<br />";
echo "<pre>";
echo 'wrappers: ', var_dump($w);
echo "</pre>";


/*
run:

openssl: yes
http wrapper: yes
https wrapper: yes

wrappers: array(11) {
  [0]=>
  string(3) "php"
  [1]=>
  string(4) "file"
  [2]=>
  string(4) "glob"
  [3]=>
  string(4) "data"
  [4]=>
  string(4) "http"
  [5]=>
  string(3) "ftp"
  [6]=>
  string(3) "zip"
  [7]=>
  string(13) "compress.zlib"
  [8]=>
  string(5) "https"
  [9]=>
  string(4) "ftps"
  [10]=>
  string(4) "phar"
}


*/

 



answered Jun 24, 2016 by avibootz

Related questions

1 answer 211 views
4 answers 300 views
1 answer 113 views
1 answer 122 views
1 answer 164 views
...