search

Home  >  Q&A  >  body text

Can a master help solve a small problem with a public account?

The test can be returned normally, and the results are normal, but the official account keeps prompting: "The service provided by this official account is faulty, please try again later."

It took me an entire afternoon, and I had no choice but to come here. Help, help

http://119.45.5.37/wechat/wechat.php

##Return result:

200 OK

Connection: Keep-Alive

Date: Mon, 01 Jun 2020 12:51:08 GMT

X-Powered-By: PHP/5.6.40

Server : Apache/2.4.37 (Win64) PHP/5.6.40

Content-Type: text/html; charset=UTF-8

Content-Length: 353

<xml> <ToUserName> <![CDATA[bbbbbbb]]> </ToUserName> <FromUserName> <![CDATA[aaaaaaa]]> </FromUserName> <CreateTime>1591015869</CreateTime> <MsgType> <![CDATA[text]]> </MsgType> <Content> <![CDATA[Hello ah ah]]> </Content> <FuncFlag>0</FuncFlag> </xml>

#$postStr = isset($GLOBALS[' HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);$fromUsername = $postObj->FromUserName;$ toUsername = $postObj->ToUserName;$keyword = trim($postObj->Content);$msgType = $postObj -> MsgType;$time = time();$textTpl = "<xml> <ToUserName> ;<![CDATA[%s]]></ToUserName> ; <FromUserName><![CDATA[%s]]></FromUserName> ;MsgType><![CDATA[%s]]></MsgType> <Content><![CDATA[%s]]></Content> </xml>";$msgType = "text";$contentStr = "Hello";$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);echo $resultStr;

嘿咻咻嘿咻咻1647 days ago901

reply all(0)I'll reply

No reply
  • Cancelreply