嘿,我试图获取网址的标题信息,
当我使用协议http它工作正常,但当我使用https时,它无法正常工作
print_r(get_headers("https://200.35.78.130/", 1));
这是我的代码
{{1}}
答案 0 :(得分:17)
That error occurs when you're trying to access a URL without a valid SSL certificate. You can work around this by overriding the default stream context, which will affect all subsequent file operations (including remote URLs)
<?php
stream_context_set_default( [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
print_r(get_headers('https://200.35.78.130/'));
答案 1 :(得分:-2)
因为您安装的SSL证书没有中间密钥