Thursday, November 24, 2011

file_get_contents with https

But unfortunately it doesn't fit the error message failed to open stream: No such file or directory. A missing wrapper would raise failed to open stream: Invalid argument and Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

Try the following script to see if there is an https wrapper available for your php scripts.

$w = stream_get_wrappers();
echo 'openssl: ',  extension_loaded  ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);
the output should be something like

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(11) {

No comments: