ASP微信公众号发送图文微信消息,只能发送给已经关注微信公众号的客户,如果没关注,可以发送到已经关注的微信公众号的客户,然后转发给其他好友看也可以的。
1 <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> 2 <!DOCTYPE html> 3 <html> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"> 7 <title>发送图文微信消息(只能是已经关注公众号的客户)</title> 8 </head> 9 <body> 10 <% 11 On Error Resume Next 12 13 Dim WxObj 14 Set WxObj = Server.CreateObject("WeixinDLL.WeixinClass") 15 WxObj.SetAppID = "AppID" 16 WxObj.SetAppSecret = "AppSecret" 17 18 Dim token,u_title,u_description,u_url,img_url 19 u_title = "[订单]曾先生你的下单的元森美酵素已成功!" 20 u_description = "收件地址:湖南省长沙市雨花区*******,收件电话:186**********,收件人:曾先生!" 21 u_url = "https://www.domain.com/" 22 img_url = "http://www.ysm365.com/Skins/product/js.jpg" 23 token = WxObj.Get_Token() ' 当前用户的access_token 24 If Trim(token) = "" Or IsNull(token) Then Response.Write "没有获取到有效的access_token,导致模板消息发送失败!" : Response.End() 25 26 Dim pJson 27 pJson = WxObj.SendPicText(OpenID, token, u_title, u_description, u_url, img_url) 28 Response.Write pJson 29 30 Set WxObj = Nothing 31 If Err Then Response.Write Err.Description 32 %> 33 </body> 34 </html>
此处用到的了WeixinDLL组件,可以加微信 z18670092211 获取进行测试使用。
浙公网安备 33010602011771号