I'm using edit feature of the API CMD_API_DNS_ADMIN to edit (mail,pop,smtp) A records of domains. I wrote the code below in PHP and It's working, but only sometimes. There are cases that adding the record is successful but deleting the old record didn't happen. How can I check the reason and solve the issue?
Code:
include_once 'httpsocket.php';
$sock = new \HTTPSocket;
$sock->connect(WEB_SERVER_DA_IP, WEB_SERVER_DA_PORT);
$sock->set_login(WEB_SERVER_DA_ADMIN_LOGIN, WEB_SERVER_DA_PASSWORD_LOGIN);
$sock->set_method('POST');
$sock->query(
'/CMD_API_DNS_ADMIN',
array(
'domain' => $domain,
'action' => 'edit',
'arecs0' => "name=mail&value=" . SERVER_IP,
'type' => 'A',
'name' => 'mail',
'value' => MAIL_SERVER,
)
);