get_headers()请求https报错解决方法

2023-06-14  阅读 390 次

php在使用get_headers()函数请求https报错,如:

get_headers(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
get_headers(): This function may only be used against URLs in

解决方法

只需要到php.ini中把extension=php_openssl.dll前面的,删掉,重启服务就可以了。(当然要确定安装了openssl模块,一般安装PHP都会自动安装的)

如果get_headers不起作用,关闭https验证

stream_context_set_default([
'ssl' => [
        'verify_host'      => false,
        'verify_peer'      => false,
        'verify_peer_name' => false,
    ],
]);
$headers = get_headers($url,1);


本文地址:http://yaaibk.com/post/368.html
版权声明:本文为原创文章,版权归 本站 所有,欢迎分享本文,转载请保留出处!

评论已关闭!