XAMPP And file_get_contents(“https://…”)

試著忘記壹切 提交于 2019-12-22 17:49:29

问题


I've tried running the next code on xampp :

$url2="https://....";
$content=file_get_contents($url2);

and that's the error I've got :

Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\xampp\htdocs\whoTalk\sys\user.php on line 38

What do I have to do in order to be able to get contents of a url which a https:// wrapper?

Thanks in advance


回答1:


In your php.ini search for the following:

extension=php_openssl.dll

If it is there and commented, uncomment it. If it is not there, add it :-)




回答2:


in WAMP I added

allow_url_include = On
extension=php_openssl.dll
extension=php_curl.dll

to all 3 php.ini files I could find, namely

\wamp\bin\php\php5.4.12\php.ini
\wamp\bin\php\php5.4.12\phpForApache.ini
\wamp\bin\apache\Apache2.4.4\bin\php.ini

I don't know which specific settings in which .ini file is actually needed, but https is accepted now....




回答3:


You would need to have the OpenSSL extension for PHP enabled in XAMPP to grab anything from a secure server.



来源:https://stackoverflow.com/questions/11453487/xampp-and-file-get-contentshttps

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!