mirror of https://github.com/gogetssl/api
Add files via upload
parent
518f424e4a
commit
edb2d0d467
|
@ -1,18 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* Use any way you want. Free for all
|
|
||||||
*
|
|
||||||
* @version 1.1
|
|
||||||
* */
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', 'on');
|
|
||||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
|
||||||
|
|
||||||
define('DEBUG', 'TRUE');
|
|
||||||
|
|
||||||
//define('DEBUG', 'FALSE');
|
|
||||||
|
|
||||||
class GoGetSSLApi {
|
class GoGetSSLApi {
|
||||||
|
|
||||||
protected $apiUrl = 'https://my.gogetssl.com/api';
|
protected $apiUrl = 'https://my.gogetssl.com/api';
|
||||||
|
@ -20,8 +7,8 @@ class GoGetSSLApi {
|
||||||
protected $lastStatus;
|
protected $lastStatus;
|
||||||
protected $lastResponse;
|
protected $lastResponse;
|
||||||
|
|
||||||
public function __construct($key = null, $apiUrl = null) {
|
public function __construct($key = null) {
|
||||||
$this->key = isset($key) ? $key : null;
|
$this->key = $key != null ? $key : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auth($user, $pass) {
|
public function auth($user, $pass) {
|
||||||
|
@ -140,7 +127,7 @@ class GoGetSSLApi {
|
||||||
return $this->call('/tools/webservers/' . (int) $type, $getData);
|
return $this->call('/tools/webservers/' . (int) $type, $getData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDomainAlternative($csr = null) {
|
public function getDomainAlternative($csr) {
|
||||||
if (!$this->key) {
|
if (!$this->key) {
|
||||||
throw new GoGetSSLAuthException ();
|
throw new GoGetSSLAuthException ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,7 +136,9 @@ class GoGetSSLApi {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$postData ['csr'] = $csr;
|
if ($csr) {
|
||||||
|
$postData ['csr'] = trim($csr);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->call('/tools/domain/alternative/', $getData, $postData);
|
return $this->call('/tools/domain/alternative/', $getData, $postData);
|
||||||
}
|
}
|
||||||
|
@ -560,26 +549,12 @@ class GoGetSSLApi {
|
||||||
|
|
||||||
$result = curl_exec($c);
|
$result = curl_exec($c);
|
||||||
|
|
||||||
if (DEBUG == 'TRUE') {
|
|
||||||
echo "\n\n";
|
|
||||||
echo "===============\n";
|
|
||||||
echo __FILE__ . "\n";
|
|
||||||
echo "===============\n\n";
|
|
||||||
echo "url = " . $url . "\n\n";
|
|
||||||
echo "queryData = " . urldecode($queryData) . "\n\n";
|
|
||||||
echo "getData = \n";
|
|
||||||
print_r($getData) . "\n\n";
|
|
||||||
echo "postData = \n";
|
|
||||||
print_r($postData) . "\n\n";
|
|
||||||
echo "result GoGetSslApi = \n";
|
|
||||||
print_r(json_decode($result, true));
|
|
||||||
echo "\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
||||||
curl_close($c);
|
curl_close($c);
|
||||||
|
|
||||||
$this->lastStatus = $status;
|
$this->lastStatus = $status;
|
||||||
$this->lastResponse = json_decode($result, true);
|
$this->lastResponse = json_decode($result, true);
|
||||||
|
|
||||||
return $this->lastResponse;
|
return $this->lastResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,5 +573,4 @@ class GoGetSSLAuthException extends Exception {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct('Please authorize first');
|
parent::__construct('Please authorize first');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue