HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=25)
-   -   Creating DNS record using the remote api (http://www.howtoforge.com/forums/showthread.php?t=53039)

HellMind 12th June 2011 13:23

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?

till 14th June 2011 12:48

Quote:

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)
Maybe you mix up sys_userid and client_id here. The client that you use has to exist, so please check that there is really a client with ID 2 in the "client" database table.

Quote:

The second problem is to add the 'a' record I need to know the id of the soa registry, how can I get that?
You get the ID back when you add the zone:

$client->dns_zone_add(....)

HellMind 14th June 2011 14:48

Quote:

Originally Posted by till (Post 258306)
Maybe you mix up sys_userid and client_id here. The client that you use has to exist, so please check that there is really a client with ID 2 in the "client" database table.

I found it in the db, also I choosed it using the drop down list box in the web interface where it shows the correct client id.

Code:

(2, 1, 1, 'riud', 'riud', '', 'xxxx. Com', 'xxx . Com', '', '', 'xxx 253', 'xx0', 'xxxxo', 'xxxe', 'AR', 'xxxxxxxxxxx7', '', '', '', 'http://xxxxxxx.com', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,cgi,mod,suphp', -1, -1, -1, 0, 'no,jailkit', 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, 0, 'xxxxxer', '291ad281e640429285d30ff25b66813d', 'es', 'default', 0, '', NULL),
Maybe it does some validation that i cant pass.

Quote:

Originally Posted by till (Post 258306)
You get the ID back when you add the zone:

$client->dns_zone_add(....)

I will try it, thank you

HellMind 2nd July 2011 19:00

I'm having another issue,
After I add the dns records I must visit the ispc panel at the registry domain , its like the changes are not active till I do that.

Maybe I should call another function to refresh de mydns config?

HellMind 29th July 2011 22:31

I need a function to activate the new dns zone I 've added.
Where can I search for that?

falko 30th July 2011 13:09

In your registrar's control panel, you must make your ISPConfig DNS servers authoritative for your domain.

http://www.howtoforge.com/how-to-run...debian-squeeze


All times are GMT +2. The time now is 15:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.