Example #1
0
    {
        $xml = $this->getDnsRowList($domain);
        foreach ($xml->data->row as $item) {
            if ($item->name == $subdomain) {
                return $item->ID;
            }
        }
        return 0;
    }
    public function updateSubdomainIp($subdomain, $domain, $ip)
    {
        $rowId = $this->getSubdomainRowId($subdomain, $domain);
        echo "rowId: " . $rowId . "\n";
        $xml = $this->cmd("dns-row-update", array("domain" => $domain, "row_id" => $rowId, "ttl" => self::TTL, "rdata" => $ip));
        print_r($xml);
    }
}
if (isset($argc) && $argc == 2) {
    $ip = $argv[1];
    echo "ip: " . $ip . "\n";
    $dns = new DNS();
    $dns->updateSubdomainIp("pi", "vician.cz", $ip);
} else {
    echo "ERROR: Wrong parameters!\n";
    echo "Usage: ./dns.php ip_addr\n";
}
//$id = $dns->getSubdomainRowId("pi","vician.cz");
//echo "pi.vician.cz: ".$id."\n";
//$dns->getDnsRowList("vician.cz");
//$xml = $dns->cmd("ping");
//print_r($xml);