Giter VIP home page Giter VIP logo

nsone-php's Introduction

About

This package provides a PHP SDK for accessing the NSONE DNS platform and includes both a simple NSONE REST API wrapper as well as a higher level interface for managing zones, records, data feeds, and more.

It requires PHP 5.3+ and the curl extension.

Getting Started

Create an API key

You'll need a REST API key. Login to the your account at http://my.nsone.net (or create a new, free account at http://nsone.net/signup). Click on Account in the top right, then Settings & Users. At the bottom, in the Manage API Keys section, click Add a New Key and set an appropriate name. If you wish, adjust permissions for this key.

Install nsone-php (Using Composer):

We recommend using composer (http://getcomposer.org) to manage the nsone-php package. If you don't already have it, first install Composer into your project directory:

curl -sS https://getcomposer.org/installer | php

Edit (or create) composer.json in your project root to include nsone-php:

{
    "require": {
        "nsone/nsone-php": "~0.1"
    }
}

Then in your project, make sure you require the composer autoloader:

require 'vendor/autoload.php';

Create config file

For example, nsone.json

{
   "default_key": "account1",
   "verbosity": 5,
   "keys": {
        "account1": {
            "key": "qACMD09OJXBxT7XOuRs8",
            "desc": "account number 1"
        },
        "account2": {
            "key": "qACMD09OJXBxT7XOwv9v",
            "desc": "account number 2"
        }
   }
}

Connect

require 'vendor/autoload.php';

use NSONE\Client;
use NSONE\Config;

$config = new Config();
$config->loadFromFile('nsone.json');

$nsone = new Client(array('config' => $config));

$zone = $nsone->createZone('newzone2.com', array('nx_ttl' => 100));
$zone->update(array('nx_ttl' => 200));
print_r($zone->qps());
print_r($zone->usage());
$zone->delete();

$zone = $nsone->loadZone('test.com');
print_r($zone->qps());

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.