消息:fsockopen():SSL操作失败,代码为1. OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
答案 0 :(得分:0)
function thread($url) {
//处理url
$parseurl = parse_url($url);
$host = $parseurl['host'];
if (isset($parseurl['query']) && $parseurl['query']) {
$requesturl = $parseurl['path'] . '?' . $parseurl['query'];
} else {
$requesturl = $parseurl['path'];
}
if ($parseurl['scheme'] == 'https') {
$fp = fsockopen('ssl://' . $host, 443, $errno, $errstr, 30);
} else {
$fp = fsockopen($host, 80, $errno, $errstr, 30);
}
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
stream_set_blocking($fp,0); //开启非阻塞模式
$out = "GET $requesturl / HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
usleep(5000);
fclose($fp);
}
}