Using PHP to develop WeChat sample code but not receiving XML form

Source: Internet
Author: User
Tags cdata
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 ~
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.