在学习使用用友平台下实名认证API(该API的商品页面
)的过程中,发现不管怎么写请求参数、不管是传参、直接赋值还是其他方式传入请求参数,请求API后的返回值都说idNumber字段为空:
{'status':'-1', 'msg':'errcode:300017, errormsg: Requied parameter can not be null: idNumber'}
问客服那边也没有任何回应。请求大佬们指点一下错误所在或者排查的方向
————————————————————
源码如下
header('Content-type:text/html;charset=utf-8');
//配置您申请的appkey
$apicode = "略";
$url = "https://api.yonyoucloud.com/apis/dst/matchIdentity/matchIdentity";
$method = "POST";
$params = array(
//"idNumber" => $_POST['ture_name2'],
//"userName" => $_POST['ture_name1'],
"idNumber" => "156103191101110000",
"userName" => "徐同学",
);
$header = array();
$header[] = "apicode:".$apicode;
$header[] = "content-type:application/json";
$header[] = "Content-Type:application/json";
echo file_put_contents("test0.txt",$header);
//这里是调用商品界面中的示例方法linkcurl
$content = linkcurl($url,$method,$params,$header);
echo file_put_contents("test.txt",$content);
$result = json_decode($content,true);
if($result){
if($result['error_code']=='0'){
echo file_put_contents("test1.txt","text1");
}else{
$custom_field_errors[] = array('custom_field_inproper_format', array('notify_announcements'));
echo file_put_contents("test2.txt","text2");
}
}else{
$custom_field_errors[] = array('custom_field_inproper_format', array('notify_announcements'));
echo file_put_contents("test3.txt","text3");
}