HostFact - Registrar class



SSL certificaten

Op deze pagina worden alle functies besproken met betrekking tot SSL certificaten. Om gebruik te kunnen maken van deze functies dient u in het bestand 'version.php' aan te geven dat de registrar SSL certificaten ondersteund, zie de voorbeeldbestanden.


ssl_list_products()

Haalt alle SSL producten op bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_type Filter voor SSL validatie ('domain', 'extended' of 'organization')

Voorbeeld implementatie
function ssl_list_products($ssl_type = '') {
	/**
	 * Step 1) get all SSL products filtered by the $ssl_type
	 */
	$response 	= true;
	
	/**
	 * Step 2) provide feedback to HostFact
	 */
    $products_array = array();

	if($response === true)
	{
        foreach($response->response->products->product as $product)
			{
				$products_array[] = array(	'name' => $product->name,
											'brand' => $product->brand,
											'templatename' => $product->code,
											'type' => 'domain'); // domain, extended or organization
			}
	}

    return $products_array;
}


ssl_get_product()

Haal een SSL product op bij een registrar.


Beschikbare variabelen Beschrijving
$templatename ID van het product van de registrar zoals teruggegeven bij ssl_list_products()

Voorbeeld implementatie
function ssl_get_product($templatename) {
	/**
	 * Step 1) get SSL product
	 */
	$response 	= true;
	
	/**
	 * Step 2) provide feedback to HostFact
	 */
    $product_info = array();

	if($response === true)
	{
		$product_info['name'] 			= $response['name'];
		$product_info['brand']          = $response['brand'];
		$product_info['templatename'] 	= $response['id'];
		$product_info['type'] 			= $response['type']; // domain, extended or organization

		$product_info['wildcard']		        = ($response['wildcard'] == 'Y') ? TRUE : FALSE;
		$product_info['multidomain']			= ($response['multidomain'] == 'Y') ? TRUE : FALSE;
		$product_info['multidomain_included']	= ($response['domains']) ? $response['domains'] : 0;
		$product_info['multidomain_max']		= ($response['domains_max']) ? $response['domains_max'] : 0;

        // Pricing-periods
		$product_info['periods'] = array();
		if(isset($response['pricing']))
		{
			foreach($response['pricing']['period'] as $index => $period_fee)
			{
                // please note: periods should be in years, not months
				$product_info['periods'][] = array('periods' => (int) $period_fee['years'], 'price' => (float) $period_fee['price']);
			}
		}
	}

	return $product_info;
}


ssl_request_certificate()

Aanvragen van een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_info Array met informatie over het SSL certificaat
(zie hoofdstuk Parameters)
$whois Object met WHOIS informatie
(zie hoofdstuk Parameters)

Voorbeeld implementatie
function ssl_request_certificate($ssl_info, $whois) {
                    
	/**
	 * Step 1) request SSL certificate at registrar
	 */
	$response 	= true;
	
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return $response['ORDERID'];
}


ssl_get_approver_list()

Haalt de approver e-mailadressen op van een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$commonname Domeinnaam
$templatename ID van het product van de registrar zoals teruggegeven bij ssl_list_products()

Voorbeeld implementatie
function ssl_get_approver_list($commonname, $templatename): array {

	/**
	 * Step 1) get list of approver email adresses at registrar
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return [];
	}

    return is_array($response['approver_list']) ? array_unique($response['approver_list']) : []; // array with e-mailadresses
}


ssl_get_request_status()

Vraagt de status op van een SSL certificaat in aanvraag bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_order_id Bestelnummer van een SSL certificaat aanvraag

Voorbeeld implementatie
function ssl_get_request_status($ssl_order_id) {

	/**
	 * Step 1) get status of SSL certificate
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    $order_info = array();
	if($response === FALSE)
	{
        $order_info['status'] = 'error';
	}

    switch(strtolower($response['status']))
    {
        default:
        case 'pending':
            $order_info['status'] = 'inrequest';
        break;

        case 'failed':
            $order_info['status'] = 'error';
        break;

        case 'active':
            $order_info['status'] = 'install';
            $order_info['activation_date'] = $response['start_date'];
            $order_info['expiration_date'] = $response['end_date'];
        break;
    }

    return $order_info;
}


ssl_download_ssl_certificate()

Download de CSR van een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_order_id Bestelnummer van een SSL certificaat aanvraag

Voorbeeld implementatie
function ssl_download_ssl_certificate($ssl_order_id) {

	/**
	 * Step 1) download the SSL certificate
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return $response['certificate'];
}


ssl_reissue_certificate()

Reissue een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_order_id Bestelnummer van een SSL certificaat aanvraag
$ssl_info Array met informatie over het SSL certificaat
(zie hoofdstuk Parameters)
$whois Object met WHOIS informatie
(zie hoofdstuk Parameters)

Voorbeeld implementatie
function ssl_reissue_certificate($ssl_order_id, $ssl_info, $whois) {

	/**
	 * Step 1) reissue the SSL certificate at the registrar
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return $response['ORDERID'];
}


ssl_renew_certificate()

Verleng een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_info Array met informatie over het SSL certificaat
(zie hoofdstuk Parameters)
$whois Object met WHOIS informatie
(zie hoofdstuk Parameters)

Voorbeeld implementatie
function ssl_renew_certificate($ssl_info, $whois) {

	/**
	 * Step 1) renew the SSL certificate at the registrar
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return $response['ORDERID'];
}


ssl_resend_approver_email()

Verstuur de approver email opnieuw.


Beschikbare variabelen Beschrijving
$ssl_order_id Bestelnummer van een SSL certificaat aanvraag
$approver_emailaddress Approver e-mailadres

Voorbeeld implementatie
function ssl_resend_approver_email($ssl_order_id, $approver_emailaddress) {

	/**
	 * Step 1) resend the approver e-mail
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return TRUE;
}


ssl_revoke_ssl_certificate()

Revoke/annuleer een SSL certificaat bij een registrar.


Beschikbare variabelen Beschrijving
$ssl_order_id Bestelnummer van een SSL certificaat aanvraag

Voorbeeld implementatie
function ssl_revoke_ssl_certificate($ssl_order_id) {

	/**
	 * Step 1) revoke the SSL certificate at the registrar
	 */
	$response 	= true;

	/**
	 * Step 2) provide feedback to HostFact
	 */
    if($response === FALSE)
	{
        $this->Error[] = 'ERROR MESSAGE';
        return FALSE;
	}

    return TRUE;
}