http_post_ssl

function http_post_ssl($url,$param,$post_file=false){
        $oCurl = curl_init();

        curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 1);
        curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
        curl_setopt($oCurl, CURLOPT_SSLCERT, WECHAT_CERT);
        curl_setopt($oCurl, CURLOPT_SSLCERTTYPE, 'PEM');
        curl_setopt($oCurl, CURLOPT_SSLKEY, WECHAT_KEY);
        curl_setopt($oCurl, CURLOPT_SSLKEYTYPE, 'PEM');

        if (is_string($param) || $post_file) {
            $strPOST = $param;
        } else {
            $aPOST = array();
            foreach($param as $key=>$val){
                $aPOST[] = $key."=".urlencode($val);
            }
            $strPOST =  join("&", $aPOST);
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt($oCurl, CURLOPT_POST,true);
        curl_setopt($oCurl, CURLOPT_POSTFIELDS,$strPOST);
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        curl_close($oCurl);
        if(intval($aStatus["http_code"])==200){
            return $sContent;
        }else{
            return false;
        }
    }


打赏

看恩吧
网站不承担任何有关评论的责任
  • 最新评论
  • 总共条评论
取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦