一、什么是企业三要素?
企业三要素即传入的企业名称、法人名称、社会统一信用代码或注册号,校验此三项是否一致。
二、具体怎么样通过PHP实现接口调用?
下面我们以阿里云为例,通过PHP示例代码进行调用,参考如下:
接口地址:https://market.aliyun.com/apimarket/detail/cmapi00068871?#sku=yuncode6287100001
<?php
$host = "https://kzcpthree.market.alicloudapi.com";
$path = "/company_three/check";
$method = "POST";
$appcode = "你自己的AppCode";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
//根据API的要求,定义相对应的Content-Type
array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
$querys = "";
$bodys = "creditCode=creditCode&companyName=companyName&legalPerson=legalPerson";
$url = $host . $path;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
var_dump(curl_exec($curl));
?>
正确返回示例代码如下:
{
"msg": "成功",
"success": true,
"code": 200,
"data": {
"result": 2, //1一致,2不一致
"orderNo": "202412012048184836138",
"companyName": true, //true 正确, false 错误
"legalPerson": false,
"creditNo": true
}
}