PHP Use CURL with SNI

--resolve [DOMAIN]:[PORT]:[IP]
curl -k -I --resolve adfs.mysite.com:443:192.168.1.100 https://adfs.mysite.com/
$url = "https://adfs.mysite.com";
$resolve = "adfs.mysite.com:443:192.168.1.100 https://adfs.mysite.com/";
$curl = curl_init();//初始化curl
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RESOLVE, array($resolve));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//跳过证书检测,信任任何证书
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 检查证书中是否设置域名
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);//要求结果为字符串且不输出到屏幕上
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);//设置等待时间
$Res = curl_exec($curl);
curl_close($curl);

参考链接:
https://hacksbrain.com/2018/08/27/testing-sni-enabled-servers-with-curl/

posted @ 2020-06-15 17:45  小猿笔记  阅读(388)  评论(0编辑  收藏  举报