-
Notifications
You must be signed in to change notification settings - Fork 0
/
getIceServers.php
42 lines (34 loc) · 985 Bytes
/
getIceServers.php
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
<?php
//set POST variables
$url = 'https://service.xirsys.com/getIceServers';
$fields_string = '';
$fields = array(
'domain' => $_POST["domain"],
'application' => $_POST["application"],
'room' => $_POST["room"],
'username' => $_POST["username"],
'ident' => urlencode("<ident>"),
'secret' => urlencode("<secret_key>"),
"secure" => "1"
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch,CURLOPT_TIMEOUT, 0);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 0);
//execute post
$result = curl_exec($ch);
// Check for errors
if($result === FALSE){
die(curl_error($ch));
}
//close connection
curl_close($ch);
?>