How do I get a pre-authorization code for WeChat open platform?

Source: Internet
Author: User
How do I get a pre-authorization code for an open platform? Which URL did you enter to get it by filling in?

Error:

Code section:

    $ch = curl_init();    $url="https://api.weixin.qq.com/cgi-bin/component/api_component_token";    $data=array(        'component_appid'=>$APPID,        'component_appsecret'=>$SECRET,        'component_verify_ticket'=>$ticket['ticket']    );    $data=http_build_query($data);    //var_dump($data);    $ch = curl_init();//打开    curl_setopt($ch, CURLOPT_POST, true);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);    $response  = curl_exec($ch);    curl_close($ch);//关闭    $result = json_decode($response,true);

Reply content:

How do I get a pre-authorization code for an open platform? Which URL did you enter to get it by filling in?

Error:

Code section:

    $ch = curl_init();    $url="https://api.weixin.qq.com/cgi-bin/component/api_component_token";    $data=array(        'component_appid'=>$APPID,        'component_appsecret'=>$SECRET,        'component_verify_ticket'=>$ticket['ticket']    );    $data=http_build_query($data);    //var_dump($data);    $ch = curl_init();//打开    curl_setopt($ch, CURLOPT_POST, true);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);    curl_setopt($ch, CURLOPT_URL, $url);    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);    $response  = curl_exec($ch);    curl_close($ch);//关闭    $result = json_decode($response,true);

AppID missing
You don't define $APPID variables.

Is the problem of $data, has been solved

Encountered the same problem, the time to pass the parameter is JSON format before the direct post 3 parameters have been {"Errcode": 41002, "errmsg": "AppID Missing"} This error. Json_encode ([' Component_appid ' =>, ' Component_appsecret ' =>, ' Component_verify_ticket ' =>]);

$data to submit in JSON format

  • 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.