api.php
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
$company = file_get_contents(__DIR__.'/company.txt');
$from_order_id = substr(md5($company),0,16);
$phone = '13818629903';
$url = 'https://biz.ai.cc/api/sync_company_for_order';
$param = [
'company_name' => $company,
'company_address' => '',
'company_tel' => $phone,
'company_email' => '',
'remark' => $company,
'level_id' => 6,
'level_day' => 365,
'from_order_id' => $from_order_id,
'nickname' => $company,
];
//sign
ksort($param);
$tem = [];
foreach ($param as $key => $val) {
$tem[] = $key . '=' . urlencode($val);
}
$string = implode('&', $tem);
$key = md5('quanqiusou.com');
$param['sign'] = md5($string . $key);
$curl = curl_init($url);
$data = json_encode($param);
$header = [
'Expect:',
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data)];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'User-Agent:Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
}
curl_close($curl);
$ress = json_decode($curl_response,true);
$data = [
'phone' => $phone,
'from_order_id' => $from_order_id, // 提单系统 同步到个项目的唯一凭证(数字或者字符串)
'timestamp' => time(), // 接收到字符串解密出来以后需要 验证时间不超过30秒 超过时间视为无效授权
'nickname' => $company, // 名称
];
echo file_get_contents('https://hub.globalso.com/api/get_aicc_link_token?'.http_build_query($data));