PHP code example of dyninc / dyn-php

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

    

dyninc / dyn-php example snippets


use Dyn\TrafficManagement;
use Dyn\TrafficManagement\Record\A;

$tm = new TrafficManagement('customerName', 'username', 'password');

// login
$tm->createSession();

// retrieve zone
$zone = $tm->getZone('example.com');

// configure a new record
$record = new A();
$record->setAddress('127.0.0.1');

// create the new record
$zone->createRecord($record, 'test.example.com');

// publish zone changes
$zone->publish();

// logout
$tm->deleteSession();

use Dyn\MessageManagement;
use Dyn\MessageManagement\Mail;

$mm = new MessageManagement('YOUR API KEY');

// setup the message
$mail = new Mail();
$mail->setFrom('[email protected]', 'Joe Bloggs')
     ->setTo('[email protected]')
     ->setSubject('Email sent via. Dyn SDK')
     ->setBody('The text of the email');

// send it
$mm->send($mail);