When using the URL and token to enable the public Platform Development Mode message interface, the display] "Your server does not respond correctly to token authentication, please read the Message Interface Usage Guide", do not know what is the case, my token verification code with the development documentation in the sample code, is the server in the SAE application. The code is as follows (I see the solution on the Internet, say write Tracehttp () This method to see Log.html file, but i in the server code directory inside and did not find log.html file), seek the guidance of the Great God
Define ("TOKEN", "Weixin");
Tracehttp ();
$WECHATOBJ = new WeChat ();
$WECHATOBJ->valid ();
Class WeChat {
Public Function valid () {
$ECHOSTR = $_get ["Echostr"];
if ($this->checksignature ()) {
Echo $echoStr;
Exit ();
}
}
Private Function Checksignature () {
$signature = $_get ["signature"];
$timestamp = $_get ["timestamp"];
$nonce = $_get ["nonce"];
$token = token;
$TMPARR = Array ($token, $timestamp, $nonce);
Sort ($TMPARR, sort_string);
$TMPSTR = implode ($TMPARR);
$TMPSTR = SHA1 ($TMPSTR);
if ($tmpStr = = $signature) {
return true;
} else {
return false;
}
}
}
function Tracehttp () {
Logger ("REMOTE_ADDR:". $_server [' REMOTE_ADDR '].
((Strpos ($_server [' REMOTE_ADDR '], "101.226"))? " From Weixin ":" Unknown IP "));
Logger ("query_string:". $_server["Query_string"]);
}
function Logger ($content)
{
File_put_contents ("\log.html", Date (' y-m-d h:i:s '). $content. "
", file_append);
}
?>
Reply to discussion (solution)
Is the URL you visited error?
Yes, I downloaded a code package on the Internet again, but it was the same as before. I uploaded it again, and then I was able to access it, not knowing what was going on.