2014年6月全國大學英語四、六級考試考試成績於2014年8月20日上午9時發布
我們提供微信查詢方法
1、關注微信公眾賬號

二、回復“四六級”

三、輸入姓名和准考證號

四、返回查詢結果

代碼實現
1 <?php
2 /*
3 方倍工作室 2014年6月全國大學英語四六級考試成績查詢
4 CopyRight 2014 All Rights Reserved
5 */
6
7 define("TOKEN", "weixin");
8
9 $wechatObj = new wechatCallbackapiTest();
10 if (!isset($_GET['echostr'])) {
11 $wechatObj->responseMsg();
12 }else{
13 $wechatObj->valid();
14 }
15
16 class wechatCallbackapiTest
17 {
18 public function valid()
19 {
20 $echoStr = $_GET["echostr"];
21 $signature = $_GET["signature"];
22 $timestamp = $_GET["timestamp"];
23 $nonce = $_GET["nonce"];
24 $token = TOKEN;
25 $tmpArr = array($token, $timestamp, $nonce);
26 sort($tmpArr);
27 $tmpStr = implode($tmpArr);
28 $tmpStr = sha1($tmpStr);
29 if($tmpStr == $signature){
30 echo $echoStr;
31 exit;
32 }
33 }
34
35 public function responseMsg()
36 {
37 $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
38 if (!empty($postStr)){
39 $this->logger("R ".$postStr);
40 $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
41 $RX_TYPE = trim($postObj->MsgType);
42
43 switch ($RX_TYPE)
44 {
45 case "event":
46 $result = $this->receiveEvent($postObj);
47 break;
48 case "text":
49 $result = $this->receiveText($postObj);
50 break;
51 }
52 $this->logger("T ".$result);
53 echo $result;
54 }else {
55 echo "";
56 exit;
57 }
58 }
59
60 private function receiveEvent($object)
61 {
62 $content = "";
63 switch ($object->Event)
64 {
65 case "subscribe":
66 $content = array();
67 $content[] = array("Title" =>"2014年6月全國大學英語四六級考試成績查詢","Description" =>"", "PicUrl" =>"http://365jia.cn/uploads/13/0301/5130c2ff93618.jpg", "Url" =>"http://apix.sinaapp.com/cet/index.php?openid=".$object->FromUserName);
68 break;
69 }
70 if(is_array($content)){
71 $result = $this->transmitNews($object, $content);
72 }else{
73 $result = $this->transmitText($object, $content);
74 }
75 return $result;
76 }
77
78 private function receiveText($object)
79 {
80 $keyword = trim($object->Content);
81 if (strstr($keyword, "四六級") || strstr($keyword, "英語")){
82 $content = array();
83 $content[] = array("Title" =>"2014年6月全國大學英語四六級考試成績查詢","Description" =>"", "PicUrl" =>"http://365jia.cn/uploads/13/0301/5130c2ff93618.jpg", "Url" =>"http://apix.sinaapp.com/cet/index.php?openid=".$object->FromUserName);
84 }else{
85 $content = date("Y-m-d H:i:s",time())."\n技術支持 方倍工作室";
86 }
87 if(is_array($content)){
88 $result = $this->transmitNews($object, $content);
89 }else{
90 $result = $this->transmitText($object, $content);
91 }
92 return $result;
93 }
94
95 private function transmitText($object, $content)
96 {
97 $textTpl = "<xml>
98 <ToUserName><![CDATA[%s]]></ToUserName>
99 <FromUserName><![CDATA[%s]]></FromUserName>
100 <CreateTime>%s</CreateTime>
101 <MsgType><![CDATA[text]]></MsgType>
102 <Content><![CDATA[%s]]></Content>
103 </xml>";
104 $result = sprintf($textTpl, $object->FromUserName, $object->ToUserName, time(), $content);
105 return $result;
106 }
107
108 private function transmitNews($object, $arr_item)
109 {
110 if(!is_array($arr_item))
111 return;
112
113 $itemTpl = " <item>
114 <Title><![CDATA[%s]]></Title>
115 <Description><![CDATA[%s]]></Description>
116 <PicUrl><![CDATA[%s]]></PicUrl>
117 <Url><![CDATA[%s]]></Url>
118 </item>
119 ";
120 $item_str = "";
121 foreach ($arr_item as $item)
122 $item_str .= sprintf($itemTpl, $item['Title'], $item['Description'], $item['PicUrl'], $item['Url']);
123
124 $newsTpl = "<xml>
125 <ToUserName><![CDATA[%s]]></ToUserName>
126 <FromUserName><![CDATA[%s]]></FromUserName>
127 <CreateTime>%s</CreateTime>
128 <MsgType><![CDATA[news]]></MsgType>
129 <Content><![CDATA[]]></Content>
130 <ArticleCount>%s</ArticleCount>
131 <Articles>
132 $item_str</Articles>
133 </xml>";
134
135 $result = sprintf($newsTpl, $object->FromUserName, $object->ToUserName, time(), count($arr_item));
136 return $result;
137 }
138
139 private function logger($log_content)
140 {
141 }
142 }
143
144
145 ?>
京東或當當都有這本書賣《微信公眾平台應用開發實戰》作者鐘志勇,騰訊公司資深軟件研發工程師兼微信公眾平台應用開發先驅者撰寫,權威性毋庸置疑
全面介紹微信公眾平台應用開發所需各項技術,系統解讀微信公眾平台開放的API和各項高級功能,逐步講解微信公眾平台應用開發的流程、方法和技巧
注重實戰,不僅通過3個案例呈現了娛樂型、應用型、游戲型應用的完整開發過程,而且還實現了一個快速開發公眾平台應用的框架,可以直接使用。
你是新注冊的賬號嗎?要是新賬號,不顯示應該是因為還沒被審核通過吧。要不是新賬號,就清理下浏覽器緩存,要麼就換台機器試試。應該不會有別的原因了。