创建服务号时能成功,但是订阅服务号的时候,返回错误如下:
{"code":1,"error":"This request must be signed by master key."}
请求头的设置和创建服务号一样,都带上了master key
function subscribeService($clientID){
$headers=array();
$headers[]='X-LC-Id: OocEy1draipXLCeRz9hMPWA9-9Nh9j0Va';
$headers[]='X-LC-Key: masterkey';
$headers[]='Content-Type: application/json';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://我的域名/1.2/rtm/service-conversations/服务号的ObjectId/subscribers');
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
$data = json_encode(array('client_id'=>$clientID));
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}
这是咋回事?