root/apps/php/trunk/sample_create_mx.php
@
363
| Revision 321, 0.9 kB (checked in by henri, 4 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | #!/opt/local/bin/php -q |
| 2 | <?php |
| 3 | // Sample script to create and delete an MX record |
| 4 | // Author: henri.tel |
| 5 | |
| 6 | include('Telhosting_Client.php'); |
| 7 | |
| 8 | $mx = array( |
| 9 | 'ttl' => 86400, |
| 10 | 'profiles' => '_all_', |
| 11 | |
| 12 | 'priority' => 0, |
| 13 | 'exchange' => 'mail.test.com', |
| 14 | ); |
| 15 | |
| 16 | // Config |
| 17 | // NOTE: THIS USES A LOCAL client.wsdl FILE AS EXPLAINED IN THE Telhosting_Client.php DOCS |
| 18 | $config = array(); |
| 19 | $config['login'] = 'xxxxxxxxxxx'; |
| 20 | $config['password'] = 'xxxxxxxxxxx'; |
| 21 | $config['wsdl'] = './client.wsdl'; |
| 22 | $domain = 'mydomain.tel'; |
| 23 | |
| 24 | // Initialize our client |
| 25 | $client = new Telhosting_client($config); |
| 26 | // Insert the mx |
| 27 | $mx_id = $client->store_record($domain, 'mx', $mx); |
| 28 | // Get records to check |
| 29 | $records = $client->list_records($domain); |
| 30 | print_r($records->{'mx'}); |
| 31 | |
| 32 | // And delete the record |
| 33 | $client->delete_record($domain, $mx_id->{'id'}); |
| 34 | $records = $client->list_records($domain); |
| 35 | print_r($records->{'mx'}); |
| 36 | ?> |
Note: See TracBrowser
for help on using the browser.








