Dear, i'm working on api system of ispconfig (specifically on the domain-dns section). What's the method in order to grab the domain_id of a domain starting from the domain itself? I'm searching something like: $domain_id=get_domain_id($domain_name); Due that all the calls of the dns are made always starting from the domain_id instead the domain name itself. Exist something like that? ty
The domain_id is not used by the dns system in ISPConfig. doman_id is a variable of the domain limit module only, so querying the dns system for it makes not much sense as it cannot provide that answer and this ID is nt useful for DNS management in ISPConfig anyway. What you can get is the primary ID of the zone that is used by the whole dns system and as reference for the dns records. The command is: $zone = $client->dns_zone_get($session_id, array('origin' => 'yourdomain.tld.'));
thank's till but diving into the code i'll get: //* Set the function parameters. $id = 1; $dns_record = $client->dns_zone_get($session_id, $id); so this one drive me crazy to understand what id was related to...
This is the primary id (database) of the dns zone. To get the zone by domain you have to use PHP: $domain = 'mydomain.com';$dns_record = $client->dns_zone_get($session_id, array('origin' => $domain));
Sorry to re-open but something to me is not totally clear. With: $zone_id = $client->dns_zone_get($session_id, array('origin' => 'yourdomain.tld.')); i'll get the id of the zone. that's fine. But from there if I use that id in order to query what NS record are set on a specific zone, return always empty result: $dns_record = $client->dns_ns_get($session_id, $zone_id); return empty array (but this zone has two ns records). I'm wrong something?
yes, sure. the complete code was: $domain_info = $client->dns_zone_get($session_id, array('origin' => 'mydomain.com.')); $zone_id=$domain_info[0]['id']; $dns_record = $client->dns_a_get($session_id, $zone_id); var_dump($dns_record); // empty wrong?
And to query the ns, you are again using the wrong settings, the second parameter is the primary ID of the zone_ns record, NOT of the zone itself. So you have to give a search array there, too: PHP: $domain = 'mydomain.com';$dns_record_id = $client->dns_zone_get_id($session_id, $domain);$dns_ns = $client->dns_ns_get($session_id, array('zone' => $dns_record_id));
Ok now, every is working. And really thank you for your help Croydon. But honestly archive that starting from the documentation included on the remoteAPI directory of the ispconfig could be pretty hard... ty