Created
February 13, 2014 14:39
-
-
Save himajin315/8976151 to your computer and use it in GitHub Desktop.
【引用】Net_DNS2(Update)を使ったサンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 引用 : http://code.google.com/p/netdns2/wiki/UpdateExample | |
require_once("Net_DNS2/Net/DNS2.php"); | |
// | |
// create a new Updater object | |
// | |
$u = new Net_DNS2_Updater('example.com', array('nameservers' => array('192.168.0.1'))); | |
try { | |
// | |
// create a new MX RR object to add to the example.com zone | |
// | |
$mx = Net_DNS2_RR::fromString('test.example.com MX 10 mail.google.com'); | |
// | |
// add the record | |
// | |
$u->add($mx); | |
// | |
// add a TSIG to authenticate the request | |
// | |
$u->signTSIG('my-key', '9dnf93asdf39fs'); | |
// | |
// execute the request | |
// | |
$u->update(); | |
} catch(Net_DNS2_Exception $e) { | |
echo "::update() failed: ", $e->getMessage(), "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment