$handle = fopen("php://stdin", "r"); $line = fgets($handle); if (trim($line)) { $domain = trim($line); } else { echo 'Log: No domain provided.' . PHP_EOL; echo 'Log: Exiting'; exit; } } else { echo "Log: Exiting"; exit; } } } $parser->load($domain, $file); $glesys = new glesys_api(); $glesys->api_user = $api_user; $glesys->api_key = $api_key; $glesys->api_url = $api_url; echo 'Log: Adding domain...' . PHP_EOL; $domainAdded = $glesys->add_domain(trim($parser->_SOA["name"], '.'), array("ttl" => $parser->_SOA["ttl"], "primarynameserver" => $parser->_SOA["origin"], "responsibleperson" => $parser->_SOA["person"], "refresh" => $parser->_SOA["refresh"], "retry" => $parser->_SOA["retry"], "expire" => $parser->_SOA["expire"], "minimum" => $parser->_SOA["minimum"], "createrecords" => 0)); if (!$domainAdded) { echo 'Err: Failed to add domain!' . PHP_EOL . PHP_EOL; echo "Continue adding records? (y/n) "; $handle = fopen("php://stdin", "r"); $line = fgets($handle); if (trim($line) != 'y') { echo 'Log: Exiting'; exit; }
<?php /** * The File_DNS example code. * * PHP versions 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category File * @package File_DNS * @author Cipriano Groenendal <*****@*****.**> * @copyright 2004-2005 Cipriano Groenendal <*****@*****.**> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id$ * @link http://pear.php.net/package/File_DNS */ require_once 'File/DNS.php'; $zone = new File_DNS(); $load = $zone->load('example.net', 'example.net'); $zone->setName('www2', 'www', 'a'); $zone->setDomainName('example.org'); $zone->setValue('127.0.0.1', ''); echo $zone->toString();