您现在的位置是:首页 >技术点滴> PHP 网站首页PHP

php curl 携带CA证书请求

CA  
private function wx_httpPost($url, $data, $cert, $key, $headers = 0) { $ip = rand(0, 255) . ‘.’ . rand(0, 255) . ‘....
private function wx_httpPost($url, $data, $cert, $key, $headers = 0)
    {
        $ip = rand(0, 255) . ‘.’ . rand(0, 255) . ‘.’ . rand(0, 255) . ‘.’ . rand(0, 255);
        $UserAgent = “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)”;
        if (!$headers) {
            $headers = [‘X-FORWARDED-FOR:’ . $ip . ”, ‘CLIENT-IP:’ . $ip . ”];
        }
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 300);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSLCERTTYPE, ‘PEM’);
        curl_setopt($ch, CURLOPT_SSLCERT, $cert);
        curl_setopt($ch, CURLOPT_SSLKEYTYPE, ‘PEM’);
        curl_setopt($ch, CURLOPT_SSLKEY, $key);
        $output = curl_exec($ch);
        curl_close($ch);
        return $output;
    }
    
    https://www.yyhy.me/76.html



转载: 感谢您对【phper】网站平台的认可,非常欢迎各位朋友分享到个人站长或者朋友圈,但转载请说明文章出处【来源 phper: http://www.birdeyes.cn/article/29/31.html】。

文章评论

请君开口
欢迎您:
    • 最新评论(0)
    暂时没有评论
Top