View Single Post
  #1  
Old 12th June 2011, 12:23
HellMind HellMind is offline
Member
 
Join Date: Jul 2008
Posts: 99
Thanks: 4
Thanked 1 Time in 1 Post
Send a message via ICQ to HellMind Send a message via MSN to HellMind
Default Creating DNS record using the remote api

Code:
<?php
$client_id = '2'; //your client id, lo ignora
$client_group_id = '3';
$domain_name = $_REQUEST['domain'];
$server =1;
$mbox='info.x.com.';
$ns='ns1.x.com';
$ip='20x.21x.2x.1x';

#-------------------
$username = 'x';
$password = 'x';

$soap_location = 'http://localhost:8080/remote/index.php';
$soap_uri = 'http://localhost:8080/remote/';

$client = new SoapClient(null, array('location' => $soap_location, 'uri'      => $soap_uri));

$session_id = $client->login($username,$password);
//Registry Add
try {
        $params = array(
                'server_id' => $server,
                'origin' => $domain_name, //replace
                'ns' => $ns,
                'mbox' => $mbox,
                'refresh' => 28800,
                'retry' => 7200,
                'expire' => 604800,
                'minimum' => 86400,
                'ttl' => 86400,
                'xfer' => "",
                'also_notify' => "",
                'update_acl' => "",
                'active' => 'y',

        );
        $client->dns_zone_add($session_id, $client_id, $params);
}
catch (SoapFault $e) {
        die('Error: '.$e->getMessage());
}
//as add
try{
        $params = array(
                'server_id' => $server,
                'name' => '*',
                'data' => $ip,
                'ttl' => 86400,
                'active' => 'y',

        );
        $client->dns_a_add($session_id, $client_id, $params);
}
catch (SoapFault $e) {
        die('Error: '.$e->getMessage());
}
echo "Agregado";
?>
With this code I can add a new soa registry but the client owner is null, it works with every client but not the one I want , which is '2'.(No error apears it just looks like if I were using Id = 0)

The second problem is to add the 'a' record I need to know the id of the soa registry, how can I get that?
__________________
Ispconfig 3 Latest Version (Stable)
Debian Squeeze (esix vm)
Reply With Quote
Sponsored Links