Replace existing zones with a DNS template
From Openprovider API documentation
Before using this script, please make sure to read API General Examples
Using this script is at your own risk!
<?php require_once('API.php'); $api = new OP_API('https://api.openprovider.eu'); $username = '--'; $password = '--'; $domains = array('name1,tld','name2,tld','name3,tld'); foreach ($domains as $domain) { $domainexploded = explode(",", $domain); $deleterequest = new OP_Request; $deleterequest->setCommand('deleteZoneDnsRequest')->setAuth(array( 'username' => $username, 'password' => $password ))->setArgs(array( 'domain' => array( 'name' => $domainexploded[0], 'extension' => $domainexploded[1] ) )); $createrequest = new OP_Request; $createrequest->setCommand('createZoneDnsRequest')->setAuth(array( 'username' => $username, 'password' => $password ))->setArgs(array( 'domain' => array( 'name' => $domainexploded[0], 'extension' => $domainexploded[1] ), 'type' => 'master', 'templateName' => 'Default' )); echo "Deleting zone: " . $domain . "\n"; $replydelete = $api->process($deleterequest); echo "Result delete (0 means no error):" . $replydelete->getFaultString() . "\n"; echo "Creating zone: " . $domain . "\n"; $replycreate = $api->process($createrequest); echo "Result create (0 means no error):" . $replycreate->getFaultString() . "\n"; } ?>