2014年5月22日星期四

java achieve micro-channel public platform to push graphic message

current program has achieved a simulated landing micro-channel public platform , and text messages sent.
but do not know that there is another diagram of how to connect the text and send messages , look great God pointing pointing.
Here is my piece of code to send text messages . Ventura message of hope and this is almost the style , or how the program changes too bad.
/**
 *  发送消息
 */
public static void sendMsg(Map<String, String> cookie, String content,
String fakeId) throws IOException {

HashMap<String, String> map = new HashMap<String, String>();
map.put("tofakeid", fakeId);
map.put("content", content);
map.put("error", "false");
map.put("token", TOKEN);
map.put("type", "1");
map.put("ajax", "1");
String referrerUrl = "https://mp.weixin.qq.com/cgi-bin/singlesendpage?t=message/send&action=index&tofakeid="+fakeId+"&token="+TOKEN+"&lang=zh_CN";
Document document = Jsoup.connect(SEND_MSG).header(USER_AGENT_H, USER_AGENT).header(REFERER_H, INDEX_URL2).referrer(referrerUrl).data(map).cookies(cookie)
.post();
Element body = document.body();
document.hashCode();
document.hasText();
System.out.println(body.text());

}

------ Solution ------------------------------------- -------
http://blog.csdn.net/lyq8479/article/details/9393195
this person's blog is well written
------ Solution ----------------------------- ---------------
the kind of message text and there how to send the connection diagram

================
look API, replies that supports both text and send pictures together :

 <xml>
 <ToUserName><![CDATA[toUser]]></ToUserName>
 <FromUserName><![CDATA[fromUser]]></FromUserName>
 <CreateTime>12345678</CreateTime>
 <MsgType><![CDATA[news]]></MsgType>
 <ArticleCount>2</ArticleCount>
 <Articles>
 <item>
 <Title><![CDATA[title1]]></Title> 
 <Description><![CDATA[description1]]></Description>
 <PicUrl><![CDATA[picurl]]></PicUrl>
 <Url><![CDATA[url]]></Url>
 </item>
 <item>
 <Title><![CDATA[title]]></Title>
 <Description><![CDATA[description]]></Description>
 <PicUrl><![CDATA[picurl]]></PicUrl>
 <Url><![CDATA[url]]></Url>
 </item>
 </Articles>
 <FuncFlag>1</FuncFlag>
 </xml> 


Parameter Description
ToUserName recipient account ( received OpenID)
FromUserName developer Micro Signal
CreateTime message creation time
MsgType news
ArticleCount number of news graphics , limited to less than 10
Articles multiple graphic message information , by default the first item for the big picture
Title Text Message title
Description Text Message Description
PicUrl image links , support JPG, PNG format , better results for the big picture 640 * 320 , 80 * 80 small images , consistent basic data limit domain image links and developers need to fill in the Url
Url Click graphic message hoplinks
------ For reference only ----------------------- in fact, the official api ----------------
has said very clear.
------ For reference only -------------------------------------- -

indeed very good, thank you for your recommendation.
------ For reference only -------------------------------------- -

Maybe I did not make it clear that I need to implement a proactive push graphic messages. But the micro-channel initiative to send a message without opening the interface , I simulated landing achieved by sending a text message. The official did not call the API interface . But I am very tangled is so active push messages simulated landing approach can achieve Teletext push ?
------ For reference only -------------------------------------- -

described above may not clear the problem , the following is the detailed information . Thank you for your answer , oh.
functional requirements : We need to take the initiative with a micro-channel push messages to a specific user .
realized functions: Because micro-channel initiative to send messages without opening the interface , but to be achieved through a simulated landing . Now able to take the initiative to push a text message to the specified micro-channel fan of .
need to implement functions: leadership now hoping to take the initiative to push graphic messages with links to the specified user .
problems : (1) I see the official API is limited to the link of the picture, " basic information restricted domain image links and developers need to fill in the Url consistent ." Means I must become a developer to push graphics news?
2. analog active call push push message + graphics API interface to achieve the initiative to push the message to the specified graphic fans do ?
------ For reference only -------------------------------------- -
landlord to solve this problem yet
------ For reference only ---------------------------- -----------
obviously not resolved
------ For reference only ------------------- --------------------
is to push, push, you know?
------ For reference only -------------------------------------- -
obviously not resolved
------ For reference only ----------------------------- ----------
landlord has not solved the same problem encountered

------ For reference only ---------------------------------- -----
Yes ! Active push ! ! ! No answer !
------ For reference only -------------------------------------- -
landlord Can you send the code by text I refer to the reference ah.
------ For reference only ---------------------------------------
Can your landlord code by sending a text I refer to the reference ah

没有评论:

发表评论