GithubHelp home page GithubHelp logo

adrenlinerush / namecheap-rest-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skpy/namecheap-rest-php

1.0 2.0 0.0 72 KB

a PHP class for accessing the Namecheap REST API

License: Apache License 2.0

namecheap-rest-php's Introduction

Namecheap-REST-PHP - a simple PHP library for using the Namecheap REST API
	http://developer.namecheap.com/docs/doku.php?id=api-reference:index

*** ABOUT ***
This is a simple single-file class for accessing the Namecheap REST API.

Methods are loosely named after the corresponding API endpoint.

namecheap.domains.check         == domainsCheck()
namecheap.domains.create        == domainsCreate()
namecheap.domains.ns.create     == nsCreate()
namecheap.domains.dns.setCustom == dnsSetCustom()

The class fully supports the Namecheap Sandbox (https://www.sandbox.namecheap.com) during object construction.

The raw response from the Namecheap API is available as a public variable "$Raw". Any call the results in an error stores the full error in a public variable "$Error".

*** USAGE ***
include_once( 'namecheap.php' );
$nc_api = array( 'api_user' => 'username',
		'api_key' => 'some_key',
		'api_ip' => 'detect'
	);
$sandbox = 'true'; // use the Namecheap sandbox to test
$nc = new Namecheap( $nc_api, $sandbox );
if ( $nc->domainsCheck( 'example.com' ) ) {
	echo "<p>example.com is available!</p>";
}
$domains = array( 'example.net', 'example.org', 'example.info' );
$results = $nc->domainsCheck( $domains );
echo "<ul>";
foreach ( $results as $domain => $available ) {
	$status = ( $available ) ? 'available' : 'not available';
	echo "<li>$domain: $status</li>";
}
echo "</ul>";

// registering a domain requires an awful lof of mandatory data:
// http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:create
// stick all that in an associative array
if ( ! $nc->domainCreate( 'example.com', $registration_data ) ) {
	print_r( $nc->Error );
}

*** LICENSE ***
   Copyright 2011 Scott Merrill

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

namecheap-rest-php's People

Contributors

skpy avatar

Stargazers

Austin Mount avatar

Watchers

Austin Mount avatar James Cloos avatar

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.