收藏
回答

小程序客服子商户无法创建商户?Not Found Connection

根据文档已经新增了临时素材获取到了icon_media_id,

但是在创建子商户时候提示调用https://api.weixin.qq.com/cgi‐bin/business/register?access_token=接口

返回了HTTP/1.1 100 Continue HTTP/1.1 404 Not Found Connection: keep-alive Date: Tue, 03-Sep-2019 01:17:44 GMT Content-Length: 0

以下是php后端代码

public function add_mcustomer(){

        $data['icon_media_id']='-Z3OVGVRiIUpV2WfUkfLSSQKpEIUVxJfUtlXTxdY2as5gfGyeUgrJuwQ8YGOmXgQ';

        $data['nickname']='小李飞刀';

        $data['account_name']='测试';

        $TOKEN=$this->getAccessToken();

        $URL='https://api.weixin.qq.com/cgi‐bin/business/register?access_token='.$TOKEN;

        $res  =$this->http_request($URL,$data); 

        var_dump($res);exit;    

    }

    public function http_request($url,$post_data = null) {  

        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL, $url);

        curl_setopt($curl, CURLOPT_HEADER, 1);

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);

        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 

        curl_setopt($curl, CURLOPT_POST, 1);

        curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);

        $data = curl_exec($curl);   

        if($data === false)

        {

            echo 'Curl error: ' . curl_error($curl);

        }       

        //关闭URL请求

        curl_close($curl);

        return $data;

    }    

    public function getAccessToken(){

        $APPID="xxxxxx";

        $APPSECRET="xxxxxxxxxxxx";

        $info=json_decode(file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$APPID&secret=$APPSECRET"));    

        //获取token

        $access_token=$info->access_token;

        return $access_token;

    }


最后一次编辑于  09-03
回答关注问题邀请回答
收藏
问题标签