-
Notifications
You must be signed in to change notification settings - Fork 2
/
gandi_contact.php
60 lines (47 loc) · 1.83 KB
/
gandi_contact.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
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
// quick and dirty create test contact
// test server and creds
//$contact = 'replace-GANDI';
//$xml_apikey = 'replace_with_your_api_key';
//$xml_server = 'https://rpc.ote.gandi.net/xmlrpc/';
//$nameservers = array('a.dns.gandi-ote.net', 'b.dns.gandi-ote.net', 'c.dns.gandi-ote.net');
// prod server and creds
$contact = 'replace-GANDI';
$xml_apikey = 'replace_with_your_api_key';
$xml_server = 'https://rpc.gandi.net/xmlrpc/';
$nameservers = array('a.dns.gandi.net', 'b.dns.gandi.net', 'c.dns.gandi.net');
// enable debug
// $debug = 1;
function createcontact () {
$contact_spec = array(
'given' => 'First',
'family' => 'Last',
'email' => 'your_email@your.domain',
'streetaddr' => '1212 Massachusetts Street',
'zip' => '02138',
'city' => 'Cambridge',
'country' => 'US',
'phone' => '+1-800-555-1212',
'type' => 0,
'password' => 'passwordything');
// end Things to configure
$contact_api = XML_RPC2_Client::create($xml_server, array('prefix' => 'contact.', 'sslverify' => false));
$contact = $contact_api->create($xml_apikey, $contact_spec);
if (isset($debug)) {print_r($contact['handle'])};
}
function chkcontact($domain, $contact, $xml_server, $xml_apikey) {
$contact_api = XML_RPC2_Client::create($xml_server, array('prefix' => 'contact.', 'sslverify' => false));
$association_spec = array(
'domain' => $domain,
'owner' => true,
'admin' => true );
print_r( $contact_api->can_associate_domain($xml_apikey, $contact, $association_spec) );
}
function chkcontacts($domain, $contact, $xml_server, $xml_apikey) {
$contact_api = XML_RPC2_Client::create($xml_server, array('prefix' => 'contact.', 'sslverify' => false));
print_r( $contact_api->list($xml_apikey) );
print_r( $contact_api->info($xml_apikey) );
}
chkcontacts($domain, $contact, $xml_server, $xml_apikey);