-
Notifications
You must be signed in to change notification settings - Fork 72
/
example.php
58 lines (45 loc) · 983 Bytes
/
example.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!doctype html>
<head>
<meta charset="utf-8">
<title>SugarCRM REST API Wrapper Class Example</title>
<style>
body {
color:#333;
font-family:verdana,arial;
font-size:14px;
float:none;
clear:both;
}
div {
padding:4px;
margin:4px;
}
div.first {
border:1px solid #8F8F8F;
margin-bottom:20px;
}
div.second {
border:1px solid #9F9F9F;
}
div.third {
border:1px solid #CCC;
}
div.fourth{
border:1px solid #CFCFCF;
}
</style>
</head>
<body>
<?php
$sugar = new \Asakusuma\SugarWrapper\Rest;
$sugar->setUrl('https://sugarcrm/service/v2/rest.php');
$sugar->setUsername('user');
$sugar->setPassword('password');
$sugar->connect();
$error = $sugar->get_error();
if($error !== FALSE) {
return $error['name'];
}
$results = $sugar->get_with_related("Accounts", array("Accounts" => array('id','name'), "Cases" => array('id','status')));
$sugar->print_results($results);
?>