forked from Snider/php-cloudDNS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.php
76 lines (49 loc) · 2.43 KB
/
sample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
*
* Rackspace DNS PHP API sample.php
* @author Alon Ben David
* @copyright CoolGeex.com
*/
$sampleImport = "coolgeex0007.com. 3600 IN SOA ns.rackspace.com. [email protected]. 1308874739 3600 3600 3600 3600
coolgeex0007.com. 86400 IN A 110.11.12.16
coolgeex0007.com. 3600 IN MX 5 mail2.coolgeex0007.com.
www.coolgeex0007.com. 5400 IN CNAME coolgeex0007.com.";
require_once "rackDNS.php";
$rs_user = 'Your_Rackspace_API_USER';
$rs_api_key = 'Your_Rackspace_API_KEY';
$dns = new rackDNS($rs_user,$rs_api_key); //($user, $key, $endpoint = 'US') $endpoint can be UK or US
// Show all domains avalible
$results = $dns->list_domains(50,0); //($limit = 10, $offset = 0)
echo "list_domains:\n"; print_r($results);
foreach($results['domains'] as $res)
{
echo $res['name'] . "\n";
$sampleID = $res['id'];
}
$results = $dns->list_subdomains($sampleID);//($domainID)
echo "list_subdomains:\n"; print_r($results);
$results = $dns->domain_export($sampleID);//($domainID)
echo "list_records:\n"; print_r($results);
$results = $dns->list_records($sampleID);//($domainID)
echo "list_records:\n"; print_r($results);
foreach($results['records'] as $res) {$recID = $res['id'];}
$results = $dns->list_record_details($sampleID,$recID);//($domainID,$recordID)
echo "list_record_details:\n"; print_r($results);
$results = $dns->domain_import($sampleImport);
echo "domain_import:\n"; print_r($results);
$results = $dns->list_domain_search('coolgeex0007.com');
echo "list_domain_search:\n"; print_r($results);
foreach($results['domains'] as $res) {$sampleID = $res['id'];}
$results = $dns->modify_domain($sampleID,'[email protected]'); //($domainID = false , $email = false , $ttl = 86400 , $comment = 'Modify Domain Using rackDNS API')
echo "modify_domain:\n"; print_r($results);
$results = $dns->delete_domains($sampleID);
echo "delete_domains:\n"; print_r($results);
//delete_domain_record($domainID,$recordID)
//list_domain_details($domainID = false, $showRecords = false, $showSubdomains = false);
//create_domain($name = false, $email = false, $records = array())
//create_domain_record($domainID = false, $records = array())
//create_domain_record_helper($type = false, $name = false, $data = false, $ttl = 86400, $priority = false)
echo "\n" . $dns->getLastResponseStatus(); //returns status code
echo "\n" . $dns->getLastResponseMessage();//returns status message
?>