-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLicenseDefenderAPI.php
More file actions
48 lines (41 loc) · 1.52 KB
/
LicenseDefenderAPI.php
File metadata and controls
48 lines (41 loc) · 1.52 KB
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
<?php
require_once('classes/RestRequest.inc.php');
class LicenseDefenderRestAPI {
public $username;
public $password;
public $url = 'http://www.licensedefender.com/api/v1/';
private $request;
public function __construct($user, $pass)
{
$this->username = $user;
$this->password = $pass;
if ( $this->username == '' || $this->password == '' ) {
throw new Exception('Please be sure to edit your reseller username and password.');
}
}
public function getLicense($domain)
{
$this->request = new RestRequest($this->url . 'license/' . $domain, 'GET');
$this->request->setUsername($this->username);
$this->request->setPassword($this->password);
$this->request->execute();
return $this->request->getResponseBody();
}
public function addLicense($domain)
{
$this->request = new RestRequest($this->url . 'license/', 'POST');
$this->request->buildPostBody(array('domain'=>$domain));
$this->request->setUsername($this->username);
$this->request->setPassword($this->password);
$this->request->execute();
return $this->request->getResponseBody();
}
public function deleteLicense($domain)
{
$this->request = new RestRequest($this->url . 'license/' . $domain, 'DELETE');
$this->request->setUsername($this->username);
$this->request->setPassword($this->password);
$this->request->execute();
return $this->request->getResponseBody();
}
}