• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

微信公众号开发xml:Xml fields error, please check your response xml!

php 搞代码 3年前 (2022-01-22) 20次浏览 已收录 0个评论
文章目录[隐藏]

php代码如下 tp框架

responseMsg();      }    }    public function responseMsg()    {    //get post data, May be due to the different environments    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];    // $tmpstr = $postStr;    libxml_disable_entity_loader(true);    $postObj = simplexml_load_string($postStr,'SimpleXMLElement', LIBXML_NOCDATA);    //extract post data    if (strtolower( $postObj->MsgType ) == 'event'){                /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,                   the best way is to check the validity of xml by yourself */                   if (strtolower( $postObj->Event == 'subscribe')) {                     $toUsername = $postObj->FromUserName;                     $fromUsername = $postObj->ToUserName;                     $time = time();                     $MsgType = 'text';                     $content = "欢迎访问我的公众号";                     $textTpl = "%s";                     $info = sprintf($textTpl,$toUsername,$fromUsername,$time,$MsgType,$content);                     echo $info;                   }        }    }}

测试结果如下:

http://120.27.115.59/wechat.php/Home/Index/wechat成功或失败:Decrypt Fail!  错误原因:Xml fields error, please check your response xml! 状态码:200    OK Headers:Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0Connection: Keep-AliveDate: Tue, 23 Aug 2016 10:23:34 GMTX-Powered-By: PHP/5.5.9-1ubuntu4.14Set-Cookie: PHPSESSID=4tlrj4jd7cgoo3ueaigc6753q7; path=/Pragma: no-cacheServer: Apache/2.4.7 (Ubuntu)Vary: Accept-EncodingExpires: Thu, 19 Nov 1981 08:52:00 GMTContent-Type: text/htmlContent-Length: 239 解密前xml:1471947814解密后xml:

回复内容:

php代码如下 tp框架

respons<span style="color:transparent">本文来源gaodai#ma#com搞*!代#%^码$网!</span><strong>搞代gaodaima码</strong>eMsg();      }    }    public function responseMsg()    {    //get post data, May be due to the different environments    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];    // $tmpstr = $postStr;    libxml_disable_entity_loader(true);    $postObj = simplexml_load_string($postStr,'SimpleXMLElement', LIBXML_NOCDATA);    //extract post data    if (strtolower( $postObj->MsgType ) == 'event'){                /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,                   the best way is to check the validity of xml by yourself */                   if (strtolower( $postObj->Event == 'subscribe')) {                     $toUsername = $postObj->FromUserName;                     $fromUsername = $postObj->ToUserName;                     $time = time();                     $MsgType = 'text';                     $content = "欢迎访问我的公众号";                     $textTpl = "%s";                     $info = sprintf($textTpl,$toUsername,$fromUsername,$time,$MsgType,$content);                     echo $info;                   }        }    }}

测试结果如下:

http://120.27.115.59/wechat.php/Home/Index/wechat成功或失败:Decrypt Fail!  错误原因:Xml fields error, please check your response xml! 状态码:200    OK Headers:Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0Connection: Keep-AliveDate: Tue, 23 Aug 2016 10:23:34 GMTX-Powered-By: PHP/5.5.9-1ubuntu4.14Set-Cookie: PHPSESSID=4tlrj4jd7cgoo3ueaigc6753q7; path=/Pragma: no-cacheServer: Apache/2.4.7 (Ubuntu)Vary: Accept-EncodingExpires: Thu, 19 Nov 1981 08:52:00 GMTContent-Type: text/htmlContent-Length: 239 解密前xml:1471947814解密后xml:

解决了。。貌似是tp的问题


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:微信公众号开发xml:Xml fields error, please check your response xml!
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址