- 需求的场景描述(希望解决的问题)
小程序客服消息推送,实现自动回复功能
POST xml数据到微信服务器后返回40003的错误
所以是我传的xml格式有问题,还是touser这个参数有问题,touser有问题的话,这个参数值要从哪里获取
- 希望提供的能力
以下是用户点击小程序按钮进入客服界面后,我的服务器收到的信息:
1548120142
以下是我服务器收到信息后作出的处理(部分代码):
用我服务器收到的FromUserName作为touser的参数值:
$fromUsername = $object->FromUserName; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$xmlData = "
";
$header[] = "Content-type: text/xml";
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $xmlData);
$response = curl_exec($ch);
if(curl_errno($ch)){
printcurl_error($ch);
}
curl_close($ch);
以下是返回的错误:
{"errcode":40003,"errmsg":"invalid openid hint: [QuAtaA01434104]"}