Two problems faced by this plugin
-
hi there,
Two problems in my wp weixin.
1,fored follower works while the QR code still showed as before only until user refresh it in weixin brower, or go back to the weblink and click to entry in.
2,the setting of server setting, plugin suggestted using, https://www.XXX.com/weixin-responder, it not works. https should be http, and the whole link needs to be https://www.XXX.com/weixin-responder.php, and I googled find the code in weixin-responder.php listed here may help others.<?php //define your token define("TOKEN", "featured token"); $wechatObj = new wechatCallbackapiTest(); $wechatObj->valid(); class wechatCallbackapiTest { public function valid() { $echoStr = $_GET["echostr"]; //valid signature , option if($this->checkSignature()){ echo $echoStr; exit; } } public function responseMsg() { //get post data, May be due to the different environments $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //extract post data if (!empty($postStr)){ $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $fromUsername = $postObj->FromUserName; $toUsername = $postObj->ToUserName; $keyword = trim($postObj->Content); $time = time(); $textTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <Content><![CDATA[%s]]></Content> <FuncFlag>0</FuncFlag> </xml>"; if(!empty( $keyword )) { $msgType = "text"; $contentStr = "Welcome to wechat world!"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr); echo $resultStr; }else{ echo "Input something..."; } }else { echo ""; exit; } } private function checkSignature() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = TOKEN; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr); $tmpStr = implode( $tmpArr ); $tmpStr = sha1( $tmpStr ); if( $tmpStr == $signature ){ return true; }else{ return false; } } } ?>
not sure it right or not, but finally token passed by WEIXIN.
My problem is the welcome information and the welcome image doesn’t show, any further movement should be done?
Thanks.Just have scanned your personally weixin account for details. Roger(大帅).
Regards
Roger(大帅)
- The topic ‘Two problems faced by this plugin’ is closed to new replies.