Title
I'm trying to do the development of public numbers with PHP,
Using the sample code,
Token verification is successful,
Can receive "Welcome to WeChat world!" This reply,
But why not receive an XML form?
Or is the XML form simply invisible?
So how do I get the content on my form?
Valid (); $WECHATOBJ->responsemsg (), class Wechatcallbackapitest{public function valid () {$echoStr = $_get["Echostr"]; Valid signature, option if ($this->checksignature ()) {echo $echoStr; Exit }} Public Function responsemsg () {//get post data, could be due to the different environments$poststr = $GLOBALS [" Http_raw_post_data "]; Extract Post Dataif (!empty ($POSTSTR)) {/* Libxml_disable_entity_loader is to prevent XML eXternal entity Injection, the best of the "to" check the validity of XML by yourself */libxml_disable_en Tity_loader (TRUE); $POSTOBJ = simplexml_load_string ($postStr, ' simplexmlelement ', libxml_nocdata); $fromUsername = $POSTOBJ->fromusername; $toUsername = $POSTOBJ->tousername; $keyword = Trim ($postObj->content); $time = time (); $TEXTTPL = "
%s
%s
%s
%s
%s
0
"; 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 () {//You must define tokens by yourself if (!defined ("TOKEN")) { throw new Exception (' TOKEN is not defined! '); } $signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get["nonce"]; $token = token; $tmpArr = Array ($token, $timestamp, $nonce); Use sort_string rulesort ($TMPARR, sort_string), $tmpStr = Implode ($TMPARR), $tmpStr = SHA1 ($TMPSTR), if ($tmpStr = = $s Ignature) {return true;} Else{return false;}}? >
Reply to discussion (solution)
This is when you implement his interface. The return value will have XML document information, directly reply to no XML document
Your reply is forwarded to you via the server, and the server will parse the XML you sent to find the corresponding recipient. Content is %s in the content
This is when you implement his interface. The return value will have XML document information, directly reply to no XML document
Then how is not direct reply ah??
Your reply is forwarded to you via the server, and the server will parse the XML you sent to find the corresponding recipient. Content is %s in the content
What should you do if you want to get the contents of an XML file?
This is when you implement his interface. The return value will have XML document information, directly reply to no XML document
Then how is not direct reply ah??
Do it for a long time, will slowly understand!
This is when you implement his interface. The return value will have XML document information, directly reply to no XML document
Then how is not direct reply ah??
Do it for a long time, will slowly understand!
I probably know what the meaning is ~ Thank you ~