Company currently in the development of enterprise number, the main implementation of the official interface function, I recently in the enterprise number callback in accordance with the official document steps to operate, download the official SDK files, deployed in the project (thinkphp), A separate controller was created to provide a GET request for callback validation and return $SECHOSTR, but always prompt
See Baidu and Google on a lot of blogs have not solved the problem, I hope that the great God can help, thank you very much!!
Paste the code that invokes the SDK:
Public Function Index ()
{ vendor('Wechatcallback.WXBizMsgCrypt'); // 假设企业号在公众平台上设置的参数如下 $encodingAesKey = "zCrCFOff4j3RrSl2WoiQv6JgLwnWKx39Y2A37Dhcnoz"; $token = "CnvrAohzXVuYD1HxV2HX5lngBx"; $corpId = "wx500667167df22bca"; $sVerifyMsgSig = urldecode($_GET["msg_signature"]); $sVerifyTimeStamp = urldecode($_GET["timestamp"]); $sVerifyNonce = urldecode($_GET["nonce"]);//"263014780"; $sVerifyEchoStr = urldecode($_GET["echostr"]); $EchoStr = ""; $wxcpt = new \WXBizMsgCrypt($token, $encodingAesKey, $corpId); $errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr); if ($errCode == 0) { print($sEchoStr); } else { print("ERR: " . $errCode . "\n\n"); }}这个方法是可以直接访问的,直接在浏览器中访问提示的是ERR:-40001
Reply content:
Company currently in the development of enterprise number, the main implementation of the official interface function, I recently in the enterprise number callback in accordance with the official document steps to operate, download the official SDK files, deployed in the project (thinkphp), A separate controller was created to provide a GET request for callback validation and return $SECHOSTR, but always prompt
See Baidu and Google on a lot of blogs have not solved the problem, I hope that the great God can help, thank you very much!!
Paste the code that invokes the SDK:
Public Function Index ()
{ vendor('Wechatcallback.WXBizMsgCrypt'); // 假设企业号在公众平台上设置的参数如下 $encodingAesKey = "zCrCFOff4j3RrSl2WoiQv6JgLwnWKx39Y2A37Dhcnoz"; $token = "CnvrAohzXVuYD1HxV2HX5lngBx"; $corpId = "wx500667167df22bca"; $sVerifyMsgSig = urldecode($_GET["msg_signature"]); $sVerifyTimeStamp = urldecode($_GET["timestamp"]); $sVerifyNonce = urldecode($_GET["nonce"]);//"263014780"; $sVerifyEchoStr = urldecode($_GET["echostr"]); $EchoStr = ""; $wxcpt = new \WXBizMsgCrypt($token, $encodingAesKey, $corpId); $errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr); if ($errCode == 0) { print($sEchoStr); } else { print("ERR: " . $errCode . "\n\n"); }}这个方法是可以直接访问的,直接在浏览器中访问提示的是ERR:-40001
Directly echo $_GET['echostr']; on the success of energy efficiency, the success of the note after the sentence on the line
Agree upstairs, there is no need to verify the real, if you go OAuth is not really? Go to developer OAuth to get user data on it!