下面矫正一下
提交的URL
$url = self::$base_url.'stocks/'.$stock_id.'?stock_creator_mchid='.$params['stock_creator_mchid'];
必须是GET请求,body=””
代码如下:
Function voucher_juan_cx(stock_creator_mchid,stock_id)
dim sXML
sXML="stock_creator_mchid="&stock_creator_mchid&""
A="GET"'GET\POST提交方式
B="/v3/marketing/favor/stocks/"&stock_id&"?"&sXML&""'URL去除域名
Datas=A&""&CHR(10)&""&B&""&CHR(10)&""×tamp&""&CHR(10)&""&nonce_str&""&CHR(10)&""&CHR(10)
signature=Encrypt.Sign(Datas,"Null",Privatekey,"SHA256","4.0.30319")
Set https = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
https.setOption(2) = 13056
'https.setOption(3)="LOCAL_MACHINE\My\证书位置"
https.setTimeouts 10 * 100, 10 * 100, 10 * 100, 10 * 100
With https
.Open ""&A&"", "https://api.mch.weixin.qq.com/v3/marketing/favor/stocks/"&stock_id&"?"&sXML&"", False
https.SetRequestHeader "Content-Type","application/json"
https.SetRequestHeader "Accept","application/json"
https.SetRequestHeader "Accept-Language","zh-CN"
https.SetRequestHeader "Authorization","WECHATPAY2-SHA256-RSA2048 mchid="""&mchid&""",nonce_str="""&nonce_str&""",timestamp="""×tamp&""",serial_no="""&serial_no&""",signature="""&signature&""""
.Send ""
voucher_juan_cx = .ResponseBody
End With
voucher_juan_cx = BytesToBstr(voucher_juan_cx,"utf-8")
Set https = Nothing
End Function
评论前必须登录!
注册