WeChat Enterprise number Echostr check failed

Source: Internet
Author: User
Keywords PHP WeChat Enterprise number
Tags oauth

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!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.