|
2 | 2 | /** api_add_dns_record - (c)2015 detain@interserver.net InterServer Hosting |
3 | 3 | * Adds a single DNS record |
4 | 4 | * @param sid string the *Session ID* you get from the [login](#login) call |
5 | | -* @param domain_id int |
| 5 | +* @param domain_id int |
6 | 6 | * @param name string Specify record name |
7 | | -* @param content string |
| 7 | +* @param content string |
8 | 8 | * @param type string Specify TYPE of record |
9 | 9 | * @param ttl int Specify TTL |
10 | | -* @param prio int |
| 10 | +* @param prio int |
11 | 11 | */ |
12 | 12 | ini_set("soap.wsdl_cache_enabled", "0"); |
13 | 13 | $username = $_SERVER['argv'][1]; |
|
18 | 18 | $type = $_SERVER['argv'][6]; |
19 | 19 | $ttl = $_SERVER['argv'][7]; |
20 | 20 | $prio = $_SERVER['argv'][8]; |
21 | | -$show_help = false; |
22 | | -if (in_array('--help', $_SERVER['argv'])) |
23 | | -{ |
24 | | - $show_help = true; |
25 | | - //break; |
26 | | -} |
27 | | -if ($_SERVER['argc'] < 9) |
28 | | - $show_help = true; |
29 | | -if ($show_help == true) |
30 | | - exit(<<<EOF |
| 21 | +$show_help = false; |
| 22 | +if (in_array('--help', $_SERVER['argv'])) { |
| 23 | + $show_help = true; |
| 24 | + //break; |
| 25 | +} |
| 26 | +if ($_SERVER['argc'] < 9) { |
| 27 | + $show_help = true; |
| 28 | +} |
| 29 | +if ($show_help == true) { |
| 30 | + exit(<<<EOF |
31 | 31 | api_add_dns_record |
32 | 32 |
|
33 | 33 | Adds a single DNS record |
|
45 | 45 |
|
46 | 46 | EOF |
47 | 47 | ); |
| 48 | +} |
48 | 49 | $client = new SoapClient("https://my.interserver.net/api.php?wsdl"); |
49 | | -try { |
50 | | - $sid = $client->api_login($username, $password); |
51 | | - if (strlen($sid) == 0) |
52 | | - die("Got A Blank Session"); |
53 | | - $res = $client->api_add_dns_record($sid, $domain_id, $name, $content, $type, $ttl, $prio); |
54 | | - echo '$res = '.var_export($res, true)."\n"; |
55 | | - } catch (Exception $ex) { |
56 | | - echo "Exception Occurred!\n"; |
57 | | - echo "Code:{$ex->faultcode}\n"; |
58 | | - echo "String:{$ex->faultstring}\n"; |
59 | | -}; |
60 | | -?> |
| 50 | +try { |
| 51 | + $sid = $client->api_login($username, $password); |
| 52 | + if (strlen($sid) == 0) { |
| 53 | + die("Got A Blank Session"); |
| 54 | + } |
| 55 | + $res = $client->api_add_dns_record($sid, $domain_id, $name, $content, $type, $ttl, $prio); |
| 56 | + echo '$res = '.var_export($res, true)."\n"; |
| 57 | +} catch (Exception $ex) { |
| 58 | + echo "Exception Occurred!\n"; |
| 59 | + echo "Code:{$ex->faultcode}\n"; |
| 60 | + echo "String:{$ex->faultstring}\n"; |
| 61 | +}; |
0 commit comments