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