buy
Install Certificate

Description

This API guide shows you how to install the certificate for your domain using a private key and certificate.

Install Certificate

Use this API to install a certificate on a selected domain using SSL private key and SSL certificate

Parameters

Sample Code

<?php
	$user = 'username';
	$pass = 'password';
	$host = 'Hostname or IP';
	 
	$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2003/index.php?api=json&act=install_cert'; 

	$post = array('install_key' => '1',
                      'selectdomain' => 'domain name',
	              'kpaste' => 'paste private key',
	              'cpaste' => 'paste certificate',
		      'bpaste' => 'paste CA bundle'
	         );

	// Set the curl parameters 
	$ch = curl_init(); 
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

	if(!empty($post)){
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
	}

	// Get response from the server. 
	$resp = curl_exec($ch);
	if(!empty(curl_error($ch))){
		echo curl_error($ch); die();
	}

	// The response will hold a string as per the API response method. 
	$res = json_decode($resp, true);
	// Done ?
	if(!empty($res['done'])){
		echo "<pre>";
		print_r($res['done']['msg']);
		echo "</pre>";
	}else{
		print_r($res['error']);
	}
	
	
?>

Output

Certificate installed successfully.

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list