Public platform development, external call interface in the form of a URL, and then write the user's attention to the text after the reply, the URL of the image is passed over the parameters
。 But I didn't get the parameters when I was concerned.
http://xxx.duapp.com/wechat/api.php?id=http://203.111.111.111:1212/img/635932895447623934.png 代码如下:
$imgurl = $_GET['id'];
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg();
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 Data if (!empty ($POSTSTR)) {$POSTOBJ = Simplexml_load_string ($POSTSTR, ' SimpleXMLElement ', libxml_nocdata); $fromUsername = $POSTOBJ->fromusername; $toUsername = $POSTOBJ->tousername; $keyword = Trim ($postObj->content); $time = time (); $imgurl = $_get[' id ']; $TEXTTPL = " %s 0 %s %s %s %s "; $ev = $POSTOBJ->event; if ($ev = = "Subscribe") {$PicUrl = $imgurl; $URL = $imgurl; $TEXTTPL = " %s %s %s news 1 <! [cdata[Welcome to join Xlobo Technology]]> 贝海科技魔镜 {$PicUrl} {$Url} ";
$RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time); Echo $resultStr; } if (!empty ($keyword)) { $msgType = "text"; Switch ($keyword) {case "1"; $CONTENTSTR = "Company profile!"; Break Case "2"; $CONTENTSTR = "Latest Offers!"; Break Case "3"; $CONTENTSTR = "The image link is as follows:". $_get[' id '); Break Default $CONTENTSTR = "Welcome!"; } $resultStr = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $conten TSTR); Echo $resultStr; }else{echo "Input something..."; } } else {echo ""; Exit }} Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get["nonce"]; $token = token; $TMPARR = Array ($token, $timestamp, $nonce); Sort ($TMPARR); $TMPSTR = implode ($TMPARR); $TMPSTR = SHA1 ($TMPSTR); if ($tmpStr = = $signature) {return true; }else{return false; } }
}
?>
Reply content:
Public platform development, external call interface in the form of a URL, and then write the user's attention to the text after the reply, the URL of the image is passed over the parameters
。 But I didn't get the parameters when I was concerned.
http://xxx.duapp.com/wechat/api.php?id=http://203.111.111.111:1212/img/635932895447623934.png 代码如下:
$imgurl = $_GET['id'];
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg();
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 Data if (!empty ($POSTSTR)) {$POSTOBJ = Simplexml_load_string ($POSTSTR, ' SimpleXMLElement ', libxml_nocdata); $fromUsername = $POSTOBJ->fromusername; $toUsername = $POSTOBJ->tousername; $keyword = Trim ($postObj->content); $time = time (); $imgurl = $_get[' id ']; $TEXTTPL = " %s 0 %s %s %s %s "; $ev = $POSTOBJ->event; if ($ev = = "Subscribe") {$PicUrl = $imgurl; $URL = $imgurl; $TEXTTPL = " %s %s %s news 1 <! [cdata[Welcome to join Xlobo Technology]]> 贝海科技魔镜 {$PicUrl} {$Url} ";
$RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time); Echo $resultStr; } if (!empty ($keyword)) { $msgType = "text"; Switch ($keyword) {case "1"; $CONTENTSTR = "Company profile!"; Break Case "2"; $CONTENTSTR = "Latest Offers!"; Break Case "3"; $CONTENTSTR = "The image link is as follows:". $_get[' id '); Break Default $CONTENTSTR = "Welcome!"; } $resultStr = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $conten TSTR); Echo $resultStr; }else{echo "Input something..."; } } else {echo ""; Exit }} Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get["nonce"]; $token = token; $TMPARR = Array ($token, $timestamp, $nonce); Sort ($TMPARR); $TMPSTR = implode ($TMPARR); $TMPSTR = SHA1 ($TMPSTR); if ($tmpStr = = $signature) {return true; }else{return false; } }
}
?>