HostFact - Registrar class



Contacten

Op deze pagina worden alle functies besproken om de contacten te beheren die onder andere gebruikt worden voor domeinnaam registraties.


createContact()

Maakt een nieuw domein contact aan.


Beschikbare variabelen Beschrijving
$whois Object met WHOIS informatie (zie hoofdstuk Parameters)
$type Contact type:
   - 'HANDLE_OWNER' = houder contact
   - 'HANDLE_ADMIN' = admin contact
   - 'HANDLE_TECH' = tech contact

Voorbeeld implementatie
function createContact($whois, $type = HANDLE_OWNER) {
	// Determine which contact type should be found
	switch($type) {
		case HANDLE_OWNER:	$prefix = "owner"; 	break;	
		case HANDLE_ADMIN:	$prefix = "admin"; 	break;	
		case HANDLE_TECH:	$prefix = "tech"; 	break;	
		default:			$prefix = ""; 		break;	
		
	}

	/**
	 * Step 1) Create the contact
	 */
	// Create the contact
	$handle 	= 'ABCDEF';
	$error_msg 	= '';
		
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($handle)
	{
		// A handle is created
		return $handle;
	}
	else
	{
		// Creating handle failed
		$this->Error[] 	= sprintf("YourName: Error while creating contact: %s", $error_msg);
		return false;			
	}
}


updateContact()

Update een domeinnaam contact richting de registrar.


Beschikbare variabelen Beschrijving
$whois Object met WHOIS informatie (zie hoofdstuk Parameters)
$type Contact type:
   - 'HANDLE_OWNER' = houder contact
   - 'HANDLE_ADMIN' = admin contact
   - 'HANDLE_TECH' = tech contact

Voorbeeld implementatie
function updateContact($handle, $whois, $type = HANDLE_OWNER) {
	// Determine which contact type should be found
	switch($type) {
		case HANDLE_OWNER:	$prefix = "owner"; 	break;	
		case HANDLE_ADMIN:	$prefix = "admin"; 	break;	
		case HANDLE_TECH:	$prefix = "tech"; 	break;	
		default:			$prefix = ""; 		break;	
		
	}

	/**
	 * Step 1) Update the contact, it can depend on the modified data which action you should take.
	 */
	// Update the contact
	$response 	= true;
	$error_msg 	= '';
		
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($response)
	{
		// If a new handle is created, you can use:
		// $this->registrarHandles[$prefix] = "ABCDEF";
		
		// handle is updated
		return true;
	}
	else
	{
		// Updating handle failed
		$this->Error[] 	= sprintf("YourName: Error while editting contact: %s", $error_msg);
		return false;			
	}
}


getContactList()

Haalt alle domeinnaam contacten op van de registrar.
Deze functie wordt gebruikt voor het importeren van domeinnamen of contacten.


Beschikbare variabelen Beschrijving
$surname kan de achternaam bevatten (indien zelf aangeroepen), om te kunnen filteren in de resultaten

Voorbeeld implementatie
function getContactList($surname = "") {
	/**
	 * Step 1) Search for contact data
	 */
	$contact_list = array(array("Handle" 		=> "C0222-042",
								"CompanyName"	=> "BusinessName",
								"SurName" 		=> "Jackson",
								"Initials"		=> "C."
						),
						array(	"Handle" 		=> "C0241-001",
								"CompanyName"	=> "",
								"SurName" 		=> "Smith",
								"Initials"		=> "John"
						)
					);


	/**
	 * Step 2) provide feedback to HostFact
	 */
	if(count($contact_list) > 0)
	{
		// Return handle list
		return $contact_list;
	}
	else
	{
		// No handles are found
		return array();			
	}
}


getContact()

Haalt alle informatie op van een domeinnaam contact.


Beschikbare variabelen Beschrijving
$handle Domein contact (bekend bij registrar)

Voorbeeld implementatie
function getContact($handle){        
  /**
	 * Step 1) Create the contact
	 */
	// Create the contact
	$response 	= true;
	$whois 		= new whois();
	$error_msg 	= '';
		
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($response)
	{
		// The contact is found
		$whois->ownerCompanyName 	= "BusinessName";
		$whois->ownerInitials		= "C.";
		$whois->ownerSurName		= "Jackson";
		$whois->ownerAddress 		= "222 E 14th Street";
		$whois->ownerZipCode 		= "10003";
		$whois->ownerCity 			= "New York";
		
		$whois->ownerCountry 		= 'US';		
		$whois->ownerPhoneNumber	= "+1 23 45 67 80";
		$whois->ownerFaxNumber 		= "+1 23 45 67 81";    
		$whois->ownerEmailAddress	= "info@hostfact.nl";
		
		return $whois;
	}
	else
	{
		// Contact cannot be found
		$this->Error[] 	= sprintf("YourName: Error while retreiving contact: %s", $error_msg);
		return $whois;			
	}
}


getContactHandle()

Controleert of er al een domeinnaam contact met dezelfde informatie bestaat. Indien er een match is, wordt het bestaande domeinnaam contact gebruikt.


Beschikbare variabelen Beschrijving
$whois Object met WHOIS informatie (zie hoofdstuk Parameters)
$type Contact type:
   - 'HANDLE_OWNER' = houder contact
   - 'HANDLE_ADMIN' = admin contact
   - 'HANDLE_TECH' = tech contact

Voorbeeld implementatie
function getContactHandle($whois = array(), $type = HANDLE_OWNER) {
	
	// Determine which contact type should be found
	switch($type) {
		case HANDLE_OWNER:  $prefix = "owner";  break;	
		case HANDLE_ADMIN:  $prefix = "admin";  break;	
		case HANDLE_TECH:   $prefix = "tech";   break;	
		default:            $prefix = "";       break;	
	}

	/**
	 * Step 1) Search for contact data
	 */
	// Search for a handle which can be used
	$handle 	= 'ABCDEF';
	
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($handle)
	{
		// A handle is found
		return $handle;
	}
	else
	{
		// No handle is found
		return false;			
	}
}


getDomainWhois()

Haalt de kenmerken van de domein contacten op.


Beschikbare variabelen Beschrijving
$domain Volledige domeinnaam (incl. extensie)

Voorbeeld implementatie
function getDomainWhois($domain){
	/**
	 * Step 1) get handles for WHOIS contacts
	 */
	$contacts = array();
	$contacts['ownerHandle'] 	= 'ABC001';
	$contacts['adminHandle'] 	= 'ABC002';
	$contacts['techHandle'] 	= 'ABC003';

	
	/**
	 * Step 2) provide feedback to HostFact
	 */
	return $contacts;
}


updateDomainWhois()

Update de houder, administratief en technisch contact informatie richting de registrar.


Beschikbare variabelen Beschrijving
$domain Volledige domeinnaam (incl. extensie)
$whois Object met WHOIS informatie (zie hoofdstuk Parameters)

Voorbeeld implementatie
function updateDomainWhois($domain,$whois){
	/**
	 * Step 1) update WHOIS data for domain.
	 */
	// update owner, tech and admin domain contact
	$response 	= true;
	$error_msg 	= '';
	
	/**
	 * Step 2) provide feedback to HostFact
	 */
	if($response === true)
	{
		// update is succesfull
		return true;
	}
	else
	{
		// update failed
		$this->Error[] 	= sprintf("YourName: Error while changing contacts for '%s': %s", $domain, $error_msg);
		return false;			
	}
}