diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/GoGetSSLApi.php b/GoGetSSLApi.php new file mode 100644 index 0000000..97025c3 --- /dev/null +++ b/GoGetSSLApi.php @@ -0,0 +1,602 @@ +key = isset($key) ? $key : null; + } + + public function auth($user, $pass) { + $response = $this->call('/auth/', array(), array( + 'user' => $user, + 'pass' => $pass + )); + + if (!empty($response ['key'])) { + $this->key = $response ['key']; + return $response; + } + + return false; + } + + public function addSslSan($orderId, $count) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + if ($count) { + $postData ['order_id'] = $orderId; + $postData ['count'] = $count; + } + + return $this->call('/orders/add_ssl_san_order/', $getData, $postData); + } + + public function cancelSSLOrder($orderId, $reason) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + $postData ['order_id'] = $orderId; + $postData ['reason'] = $reason; + + return $this->call('/orders/cancel_ssl_order/', $getData, $postData); + } + + public function changeDcv($orderId, $data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + return $this->call('/orders/ssl/change_dcv/' . (int) $orderId, $getData, $data); + } + + public function changeValidationEmail($orderId, $data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/ssl/change_validation_email/' . (int) $orderId, $getData, $data); + } + + public function setKey($key) { + if ($key) { + $this->key = $key; + } + } + + public function setUrl($url) { + $this->apiUrl = $url; + } + + /* + * Decode CSR + */ + + public function decodeCSR($csr, $brand = 1, $wildcard = 0) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + if ($csr) { + $postData ['csr'] = $csr; + $postData ['brand'] = $brand; + $postData ['wildcard'] = $wildcard; + } + + return $this->call('/tools/csr/decode/', $getData, $postData); + } + + /* + * Get Domain Emails List + */ + + public function getWebServers($type) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/tools/webservers/' . (int) $type, $getData); + } + + public function getDomainAlternative($csr = null) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + $postData ['csr'] = $csr; + + return $this->call('/tools/domain/alternative/', $getData, $postData); + } + + /* + * Get Domain Emails List + */ + + public function getDomainEmails($domain) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + if ($domain) { + $postData ['domain'] = $domain; + } + + return $this->call('/tools/domain/emails/', $getData, $postData); + } + + public function getDomainEmailsForGeotrust($domain) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + if ($domain) { + $postData ['domain'] = $domain; + } + + return $this->call('/tools/domain/emails/geotrust', $getData, $postData); + } + + /** + * @deprecated + * @return mixed + * @throws GoGetSSLAuthException + */ + public function getAllProductPrices() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/all_prices/', $getData); + } + + /** + * @deprecated + * @return mixed + * @throws GoGetSSLAuthException + */ + public function getAllProducts() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/', $getData); + } + + public function getProduct($productId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/ssl/' . $productId, $getData); + } + + public function getProducts() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/ssl/', $getData); + } + + /** + * @deprecated + * @param int $productId + * @return array + * @throws GoGetSSLAuthException + */ + public function getProductDetails($productId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/details/' . $productId, $getData); + } + + /** + * @deprecated + * @param int $productId + * @return array + * @throws GoGetSSLAuthException + */ + public function getProductPrice($productId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/price/' . $productId, $getData); + } + + public function getUserAgreement($productId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/products/agreement/' . $productId, $getData); + } + + public function getAccountBalance() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/balance/', $getData); + } + + public function getAccountDetails() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/', $getData); + } + + public function getTotalOrders() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/total_orders/', $getData); + } + + public function getAllInvoices() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/invoices/', $getData); + } + + public function getUnpaidInvoices() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/invoices/unpaid/', $getData); + } + + public function getTotalTransactions() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/account/total_transactions/', $getData); + } + + public function addSSLOrder1($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/add_ssl_order1/', $getData, $data); + } + + public function addSSLOrder($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/add_ssl_order/', $getData, $data); + } + + public function addSSLRenewOrder($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/add_ssl_renew_order/', $getData, $data); + } + + public function reIssueOrder($orderId, $data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/ssl/reissue/' . (int) $orderId, $getData, $data); + } + + public function activateSSLOrder($orderId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/ssl/activate/' . (int) $orderId, $getData); + } + + public function addSandboxAccount($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/accounts/sandbox/add/', $getData, $data); + } + + public function getOrderStatus($orderId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/status/' . (int) $orderId, $getData); + } + + public function comodoClaimFreeEV($orderId, $data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/ssl/comodo_claim_free_ev/' . (int) $orderId, $getData, $data); + } + + public function getOrderInvoice($orderId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/invoice/' . (int) $orderId, $getData); + } + + public function getUnpaidOrders() { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/list/unpaid/', $getData); + } + + public function resendEmail($orderId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + return $this->call('/orders/ssl/resend_validation_email/' . (int) $orderId, $getData); + } + + public function resendValidationEmail($orderId) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/orders/ssl/resend_validation_email/' . (int) $orderId, $getData); + } + + public function getCSR($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/tools/csr/get/', $getData, $data); + } + + public function generateCSR($data) { + if (!$this->key) { + throw new GoGetSSLAuthException (); + } else { + $getData = array( + 'auth_key' => $this->key + ); + } + + return $this->call('/tools/csr/generate/', $getData, $data); + } + + protected function call($uri, $getData = array(), $postData = array(), $forcePost = false, $isFile = false) { + $url = $this->apiUrl . $uri; + if (!empty($getData)) { + foreach ($getData as $key => $value) { + $url .= (strpos($url, '?') !== false ? '&' : '?') . urlencode($key) . '=' . rawurlencode($value); + } + } + + $post = !empty($postData) || $forcePost ? true : false; + $c = curl_init($url); + if ($post) { + curl_setopt($c, CURLOPT_POST, true); + } + + $queryData = ''; + if (!empty($postData)) { + $queryData = $isFile ? $postData : http_build_query($postData); + curl_setopt($c, CURLOPT_POSTFIELDS, $queryData); + } + + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); + + $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); + curl_close($c); + $this->lastStatus = $status; + $this->lastResponse = json_decode($result, true); + return $this->lastResponse; + } + + public function getLastStatus() { + return $this->lastStatus; + } + + public function getLastResponse() { + return $this->lastResponse; + } + +} + +class GoGetSSLAuthException extends Exception { + + public function __construct() { + parent::__construct('Please authorize first'); + } + +} diff --git a/gogetssl_sample.php b/gogetssl_sample.php new file mode 100644 index 0000000..54008ad --- /dev/null +++ b/gogetssl_sample.php @@ -0,0 +1,229 @@ +'; +$api = new GoGetSSLApi(); + +/******************************************* + * Authentication * + *******************************************/ +$authKey = $api->auth('user@domain.com', 'password' ); + +printResponse( $authKey ); + +$key = $authKey['key']; +$api->setKey($key); + +/******************************************* + * Account Methods * + *******************************************/ +/* + printResponse($api->getAccountBalance()); + printResponse($api->getAccountDetails()); + printResponse($api->getTotalOrders()); + printResponse($api->getTotalTransactions()); + printResponse($api->getAllInvoices()); + printResponse($api->getUnpaidInvoices()); +*/ + +/******************************************* + * Product Methods * + *******************************************/ +/* + printResponse($api->getAllProductPrices()); + printResponse($api->getProductPrice('58')); + printResponse($api->getProductDetails('56')); + printResponse($api->getUserAgreement('53')); + printResponse($api->getAllProducts()); +*/ + +/******************************************* + * Product Methods * + *******************************************/ +/* + printResponse($api->getOrderInvoice(1)); + printResponse($api->getOrderStatus(1)); +*/ + +$simpleCsr = "-----BEGIN CERTIFICATE REQUEST----- +MIICzjCCAbYCAQAwgYgxCzAJBgNVBAYTAkxWMQ0wCwYDVQQIDARSaWdhMQ0wCwYD +VQQHDARSaWdhMRAwDgYDVQQKDAdJVCBSaWdhMQswCQYDVQQLDAJJVDEXMBUGA1UE +AwwOdGVzdC5pdHJpZ2EubHYxIzAhBgkqhkiG9w0BCQEWFGFkbWluQHRlc3QuaXRy +aWdhLmx2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+Uhrr+r/nXw1 +u/RNc6JNalwuSXTl4eS2kpZK6rrHo4NlhIDjJVEwAnWu5Fu49tMQjrhT8mZOHCFx +xXlcRQgwjLtzrtopc06Hv92gkzfVBIj+h5e4a/je1zyqvJm3ckMPGtW9FBdpXdx0 +BbNsKPsjrbRQgVTDZMVNgSNUgtE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qrXjm3Kj+c0tDzkTkRX6oentXjmQ+jT1cYXppPDPzmNWYTgHMbvlOAndbz+0x +q5Etn2XmauzvLEkc3S36qPyma5LunBmg12I+ByyBoVM5QGrhWUJeC5oHFvmEEgUx +AQKddq+25dTdNU684Q== +-----END CERTIFICATE REQUEST-----"; + +$data = array( + 'csr' => $wildcardCSR +); + +$data = array( + 'product_id' => 45, + 'csr' => $simpleCsr, + 'server_count' => "-1", + 'period' => 12, + 'approver_email' => "admin@test.itriga.lv", + 'webserver_type' => "1", + 'admin_firstname' => "Aleksander", + 'admin_lastname' => "Andrijenko", + 'admin_phone' => "0037128216269", + 'admin_title' => "Mr", + 'admin_email' => "admin@test.itriga.lv", + 'tech_firstname' => "Aleksander", + 'tech_lastname' => "Andrijenko", + 'tech_phone' => "0037128216269", + 'tech_title' => "Mr", + 'tech_email' => "admin@test.itriga.lv", + //'dns_names' => "domain.lv,domain2.lv,domani3.lv", + 'org_name' => "AlexoMedia", + 'org_division' => "Hosting", + 'org_addressline1' => "Valdeku street 55", + 'org_city' => "Riga", + 'org_country' => "LV", + 'org_phone' => "37128216269", + 'org_postalcode' => "LV-1056", + 'org_region' => "None", + 'dcv_method' => "dns", + 'only_validate' => true // <-- Remove to place a real order +); + +// printResponse( $api->addSSLRenewOrder( $data ) ); +$output = $api->addSSLOrder( $data ); + +echo '------------------------------------------------' . PHP_EOL; + var_dump( $output ); +echo '------------------------------------------------' . PHP_EOL; + +// printResponse( $api->getUnpaidOrders() ); +$data = array( + 'org_name' => "AlexoMedia", + 'org_division' => "Hosting", + 'org_addressline1' => "Valdeku street 55", + 'org_city' => "Riga", + 'org_country' => "LV", + 'org_phone' => "37128216269", + 'org_postalcode' => "LV-1056", + 'org_duns' => "1838839939939", + 'org_region' => "None", +); + +/******************************************* + * Other Methods * + *******************************************/ +/* + 1 - comodo + 2 - verisign/geotrust/thawte +*/ +// printResponse($api->getWebServers(2)); +// printResponse($api->getDomainEmails("domain.com")); +// printResponse($api->decodeCSR($wildcardCSR,2,1)); +// printResponse($api->comodoClaimFreeEV(322, $data)); + +function printResponse($response) +{ + global $api; + + if($response) + { + print_r($response); + } + else + { + print_r($api->getLastResponse()); + } +}