|
@@ -298,14 +298,23 @@ class LoginController extends BaseController |
|
@@ -298,14 +298,23 @@ class LoginController extends BaseController |
|
298
|
}
|
298
|
}
|
|
299
|
|
299
|
|
|
300
|
public function ceshi(){
|
300
|
public function ceshi(){
|
|
301
|
- $url = 'http://openai.waimaoq.com/v1/whois_api?domain=www.baidu.com';
|
|
|
|
302
|
- $response = http_get($url);
|
|
|
|
303
|
- $start = '';
|
|
|
|
304
|
- $end = '';
|
|
|
|
305
|
- if($response['code'] == 200){
|
|
|
|
306
|
- $start = $response['text']['creation_date'];
|
|
|
|
307
|
- $end = $response['text']['expiration_date'];
|
301
|
+ $context = stream_context_create([
|
|
|
|
302
|
+ 'ssl' => [
|
|
|
|
303
|
+ 'capture_peer_cert' => true,
|
|
|
|
304
|
+ 'capture_peer_cert_chain' => false,
|
|
|
|
305
|
+ ],
|
|
|
|
306
|
+ ]);
|
|
|
|
307
|
+ $stream = stream_socket_client('ssl://www.baidu.com:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
|
|
|
|
308
|
+ if(!$stream) {
|
|
|
|
309
|
+ die("Failed to connect: $errno - $errstr");
|
|
|
|
310
|
+ }
|
|
|
|
311
|
+ $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];
|
|
|
|
312
|
+ if(!$remote_cert) {
|
|
|
|
313
|
+ die("Failed to retrieve certificate");
|
|
308
|
}
|
314
|
}
|
|
309
|
- return ['start'=>$start,'end'=>$end];
|
315
|
+ $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);
|
|
|
|
316
|
+ $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
|
|
|
|
317
|
+ fclose($stream);
|
|
|
|
318
|
+ return ['from'=>$valid_from,'to'=>$valid_to];
|
|
310
|
}
|
319
|
}
|
|
311
|
} |
320
|
} |