-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathauthKey.php
More file actions
43 lines (31 loc) · 828 Bytes
/
authKey.php
File metadata and controls
43 lines (31 loc) · 828 Bytes
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
<?php
//获取authKey
$dir = dirname(__FILE__);
require_once($dir . '/config.php');
$userid = array_key_exists('userid', $_REQUEST) ? $_REQUEST['userid'] : 0;
if(empty($userid)){
echoErr('missing args');
}
//log_to_file($userid);
$url = 'https://api.starRTC.com/aec/authKey';
$post_data = array (
'appid' => appid,
'secret' => secret,
'userid' => $userid
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$result = curl_exec($ch);
curl_close($ch);
$data = json_decode($result, TRUE);
//echoDebug($result);
if($data['status'] == 1){
$authKey = $data['data'];
echoK($authKey);
}else{
echoErr($data['data']);
}
return;