zoukankan      html  css  js  c++  java
  • 关于微信支付服务器证书更换的提醒

    收到一封邮件如下:

    微信支付服务器证书更换

    微信支付计划于2018年5月29日更换服务器证书。请开发人员尽快进行服务器根证书验证,以免影响正常交易。

    但是好像跟PHP没有关系,详情见地址:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=23_4#menu2

    安装说明,写了一段代码验证证书:

    <?php
    function check_wx() {
                $mch_id = '1472935992'; // 商户号
            $key = '14c507c22ed1sdbdffce5877a5322a54'; // 商户支付密钥
            $nonce_str = strtoupper(md5('3123123131')); // 随机字符串
     
            // 开始生成sign
            $str = "mch_id=".$mch_id."&nonce_str=".$nonce_str."&key=".$key;
            $sign = strtoupper(md5( $str ));
     
     
            // 打印字符串和签名
            echo $nonce_str;
            echo "<br />";
            echo $sign;
     
     
            $xml = "<xml>
                      <mch_id>1495281252</mch_id>
                      <nonce_str>4E74A5EC8F10C3E7EECE6D8D574CB861</nonce_str>
                      <sign>BFB9329EC7B027DF83AFB848F08E8077</sign>
                    </xml>";
            $url = "https://apitest.mch.weixin.qq.com/sandboxnew/pay/getsignkey";
            /*$a = '{"mch_id":"1495281252","nonce_str":"4E74A5EC8F10C3E7EECE6D8D574CB861","sign":"BFB9329EC7B027DF83AFB848F08E8077"}';*/
            // $result = http_request($url,$xml);
            $result = postXmlCurl($xml,$url);
            var_dump($result);
     
     
     
     
        }
        /**
         *  作用:以post方式提交xml到对应的接口url
         */
        function postXmlCurl($xml,$url,$second=30)
        {      
            //初始化curl       
            $ch = curl_init();
            //设置超时  CURLOP_TIMEOUT
            //curl_setopt($ch, CURLOP_TIMEOUT, $second);
            curl_setopt($ch, CURLOPT_TIMEOUT, $second);
            //这里设置代理,如果有的话
            //curl_setopt($ch,CURLOPT_PROXY, '8.8.8.8');
            //curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
            curl_setopt($ch,CURLOPT_URL, $url);
            curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
            curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
            //设置header
            curl_setopt($ch, CURLOPT_HEADER, FALSE);
            //要求结果为字符串且输出到屏幕上
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            //post提交方式
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
            //运行curl
            $data = curl_exec($ch);
            //curl_close($ch);
            //返回结果
            if($data)
            {
                curl_close($ch);
                return $data;
            }
            else
            {
                $error = curl_errno($ch);
                //echo "curl出错,错误码:$error"."<br>";
                //echo "<a href='http://curl.haxx.se/libcurl/c/libcurl-errors.html'>错误原因查询</a></br>";
                curl_close($ch);
                return false;
            }
        }
          check_wx();  
            
    ?>

    返回内容如下:

    4E74A5EC8F10C3E7EECE6D8D574CB891<br />AD622820D6A0DAFD2759191A08EC70C9string(185) "<xml>
      <return_code><![CDATA[SUCCESS]]></return_code>
      <return_msg><![CDATA[ok]]></return_msg>
      <sandbox_signkey><![CDATA[dfddf9f3374aa77dfb49260749945856]]></sandbox_signkey>
    </xml>"

    说明没有问题,完毕。

  • 相关阅读:
    JDK1.7.0环境变量配置【Windows】
    QQ游戏百万人同时在线服务器架构实现
    C#关于AutoResetEvent的使用介绍[转载]
    ConcurrentDictionary:.NET 4.0中新的线程安全的哈希表
    大型网站采用的具有稳定性的系统构架
    简单使用Enterprise Library 5.0 中的Cache功能
    来电显示MODEM的的选购指南
    浅谈大型网站动态应用系统架构
    log4net工程中使用备忘
    稳定高效大型系统架构集群中间件开发
  • 原文地址:https://www.cnblogs.com/zl0372/p/weixin_cert.html
Copyright © 2011-2022 走看看