PHP code example of hostmyservers / netim-rest_api

1. Go to this page and download the library: Download hostmyservers/netim-rest_api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hostmyservers / netim-rest_api example snippets


use HostMyServers\NetimRestApi\NetimClient;

// Initialize the client
$netim = new NetimClient();

// Check domain availability
$availability = $netim->domain->checkDomain('example.com');

// Get domain information
$domainInfo = $netim->domain->getDomainInfo('example.com');

// Update DNS servers
$nameservers = [
    'ns1.example.com',
    'ns2.example.com'
];
$dnsUpdate = $netim->domain->updateDNS('example.com', $nameservers);

// Enable WHOIS privacy
$privacy = $netim->domain->setWhoisPrivacy('example.com', true);

// Get list of all domains
$allDomains = $netim->domain->getDomainsList();

use HostMyServers\NetimRestApi\Exceptions\NetimException;

try {
    $domainInfo = $netim->domain->getDomainInfo('example.com');
} catch (NetimException $e) {
    echo "Error: " . $e->getMessage();
    echo "API Error Code: " . $e->getApiErrorCode();
    echo "API Error Data: " . print_r($e->getApiErrorData(), true);
}

// Check if session is active
if ($netim->hasActiveSession()) {
    // Do something
}

// Force session renewal
$netim->renewSession();

// Manually close session
$netim->closeSession();
bash
php artisan vendor:publish --provider="HostMyServers\NetimRestApi\NetimServiceProvider"