parameters for addzonrecord
ajdove opened this issue · comments
I have read the documentation for cPanel_XMLAP_Client_Class addzonerecord() . I am relatively new to the concept of editing dns settings. It gives the required parameters as :
* @param string $zone The DNS zone that you want to add the record to
* @param array $args Associative array representing the record to be added
What is the name of the zone record so as I can use it as a parameter?
and:
Where can I get a list of the required fields and their format for the array?
for example is this the right idea? or close to it?
I have searched the cPanel documentation but have been unable to come up with an answer.
I think the record name in this case would be the slt.tld. ( not the period at the end )
...... [ if you look at how DNS records are setup .. this is inherited from @ .. hostname and period )
here's an example of editing a zone with arguments ..
- read the zone and find the line# you want to edit
- edit the zone providing that line#
I understand you are trying to Add rather than Edit, but perhaps this will shed some light, giving
the $recordname is the same in this case;
( for adding a zone we actually use addondomain api 2 - it creates it in cpanel, and also creates the dns zone, ping me if you want an example of that too ) ..
hope it helps:
for #1:
.. $fetch_zone = $json_client->api2_query( $cpaneluser, 'ZoneEdit', 'fetchzone', $domainarg ) ;
( and $domainarg is $domainarg = array ( 'domain' => $domain, 'type' => 'A'); - in
our case, we are looking into editing the A pointing )
for #2:
$resultstr = $json_client->api2_query( $auth_user, 'ZoneEdit', 'edit_zone_record', $dnsargs );
but in this case the $dnsargs would be:
$dnsargs = array('Line' => $DNS_RECORD_LINE_NUMBER, 'domain' => $domain,
'name' => $record_name, 'type' => 'A', 'address' => $ip2go,
'ttl' => '14400', 'class' => 'IN',
);
where:
-$DNS_RECORD_LINE_NUMBER was fetched on #1
now the $record that you are asking about should be:
-$record is the domain name that you are adding -with a period ( domain.com. <-note period at the end)
-$type is A .. in our context.
..
hope that helps,