XAMPP和file_get_contents(“https:// ...”)

时间:2012-07-12 13:59:18

标签: php xampp

我尝试在xampp上运行下一个代码:

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

这就是我得到的错误:

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

为了能够获取https://包装器的网址内容,我该怎么做?

提前致谢

3 个答案:

答案 0 :(得分:10)

在php.ini中搜索以下内容:

extension=php_openssl.dll

如果有,请注释,取消注释。如果不存在,请添加: - )

答案 1 :(得分:1)

在WAMP中我添加了

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

我能找到的所有3个php.ini文件,即

\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

我不知道实际需要哪个.ini文件的具体设置,但现在接受https ....

答案 2 :(得分:0)

您需要在XAMPP中启用PHP的OpenSSL扩展,以便从安全服务器中获取任何内容。