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);