postThe JSON data format is
{
"action_name": "QR_LIMIT_SCENE",
"action_info": {
"scene": {
"scene_id": 123
}
}
}
It is possible to generate a permanent parameter two-dimensional code with a parameter
https://mp.weixin.qq.com/cgi-…
We want to scan the two-dimensional code to recover the parameters of the public number in the two-dimensional code.
Then time
WeChat reply is
$postArr =$GLOBALS['HTTP_RAW_POST_DATA'];
$postObj = simplexml_load_string( $postArr );
if($postObj->Event == 'SCAN'){
$toUser = $postObj->FromUserName;
$fromUser = $postObj->ToUserName;
$time = time();
$msgType = 'text';
$content = 'Scavenging!'.$postObj-> EventKey;$template = "< xml>< ToUserName> <! [CDATA[%s]]> < /ToUserName>< FromUserName> <; [CDATA[%s]]> < /FromUserName>< CreateTime>%s< /CreateTime>< MsgType> <! [CDATA[%s]]> < /MsgType>< Content> <; [CDATA[%s]]> < /Content>< /xml> ";$info = sprintf ($template, $toUser, $fromUser, $time, $msgType, $content);Echo $info;
However, there is a public service failure after the scan. Please try again later.
What’s the problem
In general, your code is abnormal, response code 500 and so on.
The code is wrong, and it prompts this
You should be feeling the opposite. When you push the scan event, the from and to are the opposite. And scan code is the two event, the other is subscribe scanning attention to the public number, your scan event is already concerned about scan code.