asp根據(jù)公中號(hào)接口給關(guān)注用戶發(fā)送消息
代碼如下
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Lib/TmplMsg.asp"-->
<%
Dim a
Set a = New TmplMsg
Dim openid, template_id, url, first_data, first_color, keyword1_data, keyword1_color, keyword2_data, keyword2_color, keyword3_data, keyword3_color, keyword4_data, keyword4_color, keyword5_data, keyword5_color, remark_data, remark_color
openid = "opSHYjnZAnqPh8Cy9LIOEQXnlA90" '接收者openid
template_id = "atfaINoGHQmDNQ01Lx3jmokln5TT5X1YMStpCTjBZSg" '模板ID
url = "http://wwww.schoolgz.com/zwqt_view.asp?id=123" '模板跳轉(zhuǎn)鏈接(海外帳號(hào)沒有跳轉(zhuǎn)能力)
first_data = "您剛剛成功發(fā)布了一個(gè)新職位,趕緊推廣一下吧!" '
first_color = "#000000" '字體顏色
keyword1_data = "JAVA開發(fā)工程師"
keyword1_color = "#000000"
keyword2_data = "上海"
keyword2_color = "#000000"
keyword3_data = "50-80萬/年"
keyword3_color = "#000000"
keyword4_data = "2014-08-07 16:11"
keyword4_color = "#000000"
remark_data = "點(diǎn)擊詳情后立即推廣職位"
remark_color = "#000000"
Dim s_res
s_res = a.Send_TmplMsg(openid, template_id, url, first_data, first_color, keyword1_data, keyword1_color, keyword2_data, keyword2_color, keyword3_data, keyword3_color, keyword4_data, keyword4_color, remark_data, remark_color)
If split(split(s_res,",")(0),":")(1) = 0 Then
Response.Write("成功")
Else
Response.Write("失敗")&"<br>"
response.Write s_res&"<br>"&Application("Access_Token")
End If
Set a = Nothing
%>
這個(gè)已經(jīng)成功測(cè)試完成 注意Access_Token不要重復(fù)獲取
要用公用的Access_Token 這樣才能不至于沖突 而導(dǎo)致發(fā)送消息失!也就是說Access_Token只能調(diào)取一次 各個(gè)頁面公用!