网站制作学习网PHP→正文:file_get_contents https ssl 错误
字体:

file_get_contents https ssl 错误

PHP 2022/7/21 21:17:25  点击:不统计

<本文原载于www.forasp.cn>
在做php 远程获取 https 内容时,提示报错  [function.file-get-contents]: failed to open stream: Invalid argument

网上找了额一下解决方案如下:
 
1.打开php.ini文件,extension=php_openssl.dll去掉前面的分号,allow_url_include = off改为allow_url_include = On,
 2.通过php代码实现
<?php
$option=array(
    "ssl"=>array(
        "verify_peer"=>false,
        "verify_peer_name"=>false,
    ),
); 
 
$response = file_get_contents("https://xxx.com/xxx.html", false, stream_context_create($option)); 
echo $response; 
?>
 
原文:https://www.cnblogs.com/devcjq/articles/9250800.html

%77w%77%2E%66%6F%72%61%73%70%2E%63%6E

·上一篇:thinkphp6模板变量调用函数 >>    ·下一篇:php.ini pdo_mysql无效 >>
推荐文章
最新文章