我希望能够使用CURL读取SSL证书信息.从Linux控制台我得到这个响应头:
GET https://www.google.com/ -ed
Cache-Control: private, max-age=0
Connection: close
Date: Sun, 20 Jun 2010 21:34:12 GMT
Server: gws
Content-Type: text/html; charset=ISO-8859-1
Expires: -1
Client-Date: Sun, 20 Jun 2010 21:34:18 GMT
Client-Peer: 66.102.13.106:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
Client-SSL-Cert-Subject: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
Client-SSL-Cipher: RC4-SHA
Client-SSL-Warning: Peer certificate not verified
Set-Cookie: PREF=ID=4d56960f6e3ad831:TM=1277069652:LM=1277069652:S=GF-w8Yc-_61NBzzJ; expires=Tue, 19-Jun-2012 21:34:12 GMT; path=/; domain=.google.com
Title: Google
X-XSS-Protection: 1; mode=block
Run Code Online (Sandbox Code Playgroud)
但是使用CURL,标题要短得多:
HTTP/1.1 200 OK
Date: Sun, 20 Jun 2010 21:39:07 GMT
Expires: -1
Cache-Control: private, …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 PHP 向我的 websocket aws api 网关发送一个即发即弃的请求。
我已经设置了一个名为“发送消息”的操作。
这是我正在使用的代码:
$protocol = "ssl";
$host = "<myendpoint>.amazonaws.com";
$port = 443;
$path = "/<mystage>/";
$timeout = 2000;
$socket = pfsockopen($protocol . "://" . $host, $port,
$errno, $errstr, $timeout);
$content = "{'action': 'sendmessage', 'data': 'test'}";
$body = "POST $path HTTP/1.1\r\n";
$body .= "Host: $host\r\n";
$body .= "Content-Type: application/json\r\n";
$body .= "Content-Length: " . strlen($content) . "\r\n";
$body .= "Connection: Close\r\n\r\n";
$body .= $content;
$body .= "\r\n";
fwrite($socket, $body);
Run Code Online (Sandbox Code Playgroud)
然而,什么也没有发生。
如果我使用 wscat,例如:
wscat -c wss://<my-endpoint>.amazonaws.com/<my-stage> …Run Code Online (Sandbox Code Playgroud)