-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonsip.php
More file actions
41 lines (32 loc) · 853 Bytes
/
onsip.php
File metadata and controls
41 lines (32 loc) · 853 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
<?php
// Include functions for XML
include 'xml.php';
$_URL = 'https://api.onsip.com/api';
$_SESSION = null;
function post_onsip_action($action,$data) {
global $_SESSION;
global $_URL;
if ( isset ( $_SESSION ) ) {
$action .= "&SessionId=$_SESSION";
}
$post = "Action=" . $action . '&' . $data;
if ( isset($_POST['dump']) ) {
print $post . "\n";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return xml_to_array($response);
};
function set_onsip_session($xml) {
global $_SESSION;
$_SESSION = $xml['Context']['Session']['SessionId'];
if ( isset($_POST['dump']) ) {
print "SessionId:" . $_SESSION . "\n";
}
};
?>