-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
36 lines (29 loc) · 997 Bytes
/
init.php
File metadata and controls
36 lines (29 loc) · 997 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
<?php
//Get your user UserCode and API token from https://www.lessannoyingcrm.com/app/Settings/Api
$UserCode = "ABCDE";
$APIToken = "111111111111111111111111111111111111111111111111";
function CallAPI($Function, $Parameters){
global $UserCode, $APIToken;
$EndpointURL = "https://api.lessannoyingcrm.com";
$APIResult = file_get_contents("$EndpointURL?UserCode=$UserCode&APIToken=$APIToken&".
"Function=$Function&Parameters=".urlencode(json_encode($Parameters)));
$APIResult = json_decode($APIResult, true);
if(@$APIResult['Success'] === true){
return $APIResult;
}
else{
echo "API call failed.<br/>Function: $Function<br/>Error: ".@$APIResult['Error']."<br/>Paramters you passed to the function:";
DebugOutput($Parameters);
exit;
}
}
function DebugOutput($Text, $Echo=true, $IncludeHR=true){
if(!$Echo)
ob_start();
echo "<pre>";
print_r($Text);
echo "</pre>".($IncludeHR ? "<hr />":"");
if(!$Echo)
return ob_get_clean();
}
?>