PHP code example of transip / transip-api-php

1. Go to this page and download the library: Download transip/transip-api-php 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/ */

    

transip / transip-api-php example snippets




use Transip\Api\Library\TransipAPI;

ebsite.
$login = '';

// If the generated token should only be usable by whitelisted IP addresses in your Controlpanel
$generateWhitelistOnlyTokens = true;

// One of your private keys; these can be requested via your Controlpanel
$privateKey = '';

$api = new TransipAPI(
    $login,
    $privateKey,
    $generateWhitelistOnlyTokens
);

// Create a test connection to the api
$response = $api->test()->test();

if ($response === true) {
    echo 'API connection successful!';
}

$allDomains = $api->domains()->getAll();

$homeIpAddress = '37.97.254.1'; 

$dnsEntry = new \Transip\Api\Library\Entity\Domain\DnsEntry();
$dnsEntry->setName('homeip'); // subdomain
$dnsEntry->setExpire(300);
$dnsEntry->setType('A');
$dnsEntry->setContent($homeIpAddress);

$api->domainDns()->updateEntry('example.com', $dnsEntry);
bash
composer