我正在使用此代码测试与curl建立连接:
$url = "https://www.google.com";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_STDERR, $fp);
curl_setopt($ch, CURLOPT_CERTINFO, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
//curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
$result = curl_exec($ch);
curl_errno($ch)==0 or die("Protocol SSLv3 Disabled.\n\nError:".curl_errno($ch)." ".curl_error($ch));
fseek($fp, 0);//rewind
$str='';
while(strlen($str.=fread($fp,8192))==8192);
echo $str;
输出如下:
* Rebuilt URL to: https://www.google.com/
* Hostname was NOT found in DNS cache
* Trying 74.125.237.211...
* Connected to www.google.com (74.125.237.211) port 443 (#0)
* SSL connection using SSLv3 / ECDHE-RSA-AES128-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=www.google.com
* start date: 2015-04-08 14:16:31 GMT
* expire date: 2015-07-07 00:00:00 GMT
* issuer: C=US; O=Google Inc; CN=Google Internet Authority G2
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> HEAD / HTTP/1.1
Host: www.google.com
Accept: */*
< HTTP/1.1 302 Found
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< Location: https://www.google.com.au/?gfe_rd=cr&ei=0FY_Vd7PD8yN8Qe80IEI
< Content-Length: 261
< Date: Tue, 28 Apr 2015 09:45:52 GMT
< Server: GFE/2.0
< Alternate-Protocol: 443:quic,p=1
<
* Connection #0 to host www.google.com left intact
我想要取消SSL信息后显示的所有信息。基本上> HEAD / HTTP 1.1
以及我想要显示的所有内容都无法显示。
关于如何实现这一目标的任何想法?
答案 0 :(得分:0)
将verbose参数设置为1.也许您可以将其设置为0并显示输出。
我一直在寻找如何获得输出详细信息:)