|
1 | 1 | <?php |
2 | 2 | /** api_api_auto_cpanel_login - (c)2015 detain@interserver.net InterServer Hosting |
3 | | -* Logs into cpanel for the given website id and returns a unique logged-in url. |
| 3 | +* Logs into cpanel for the given website id and returns a unique logged-in url. |
4 | 4 | * The status will be "ok" if successful, or "error" if there was any problems |
5 | 5 | * status_text will contain a description of the problem if any. |
6 | 6 | * @param sid string the *Session ID* you get from the [login](#login) call |
|
10 | 10 | $username = $_SERVER['argv'][1]; |
11 | 11 | $password = $_SERVER['argv'][2]; |
12 | 12 | $id = $_SERVER['argv'][3]; |
13 | | -$show_help = false; |
14 | | -if (in_array('--help', $_SERVER['argv'])) |
15 | | -{ |
16 | | - $show_help = true; |
17 | | - //break; |
18 | | -} |
19 | | -if ($_SERVER['argc'] < 4) |
20 | | - $show_help = true; |
21 | | -if ($show_help == true) |
22 | | - exit(<<<EOF |
| 13 | +$show_help = false; |
| 14 | +if (in_array('--help', $_SERVER['argv'])) { |
| 15 | + $show_help = true; |
| 16 | + //break; |
| 17 | +} |
| 18 | +if ($_SERVER['argc'] < 4) { |
| 19 | + $show_help = true; |
| 20 | +} |
| 21 | +if ($show_help == true) { |
| 22 | + exit(<<<EOF |
23 | 23 | api_api_auto_cpanel_login |
24 | 24 |
|
25 | 25 | Logs into cpanel for the given website id and returns a unique logged-in url. |
|
33 | 33 | <id> Must be a int |
34 | 34 |
|
35 | 35 | EOF |
36 | | -); |
| 36 | +); |
| 37 | +} |
37 | 38 | $client = new SoapClient("https://my.interserver.net/api.php?wsdl"); |
38 | | -try { |
39 | | - $sid = $client->api_login($username, $password); |
40 | | - if (strlen($sid) == 0) |
41 | | - die("Got A Blank Session"); |
42 | | - $res = $client->api_api_auto_cpanel_login($sid, $id); |
43 | | - echo '$res = '.var_export($res, true)."\n"; |
44 | | - } catch (Exception $ex) { |
45 | | - echo "Exception Occurred!\n"; |
46 | | - echo "Code:{$ex->faultcode}\n"; |
47 | | - echo "String:{$ex->faultstring}\n"; |
48 | | -}; |
49 | | -?> |
| 39 | +try { |
| 40 | + $sid = $client->api_login($username, $password); |
| 41 | + if (strlen($sid) == 0) { |
| 42 | + die("Got A Blank Session"); |
| 43 | + } |
| 44 | + $res = $client->api_api_auto_cpanel_login($sid, $id); |
| 45 | + echo '$res = '.var_export($res, true)."\n"; |
| 46 | +} catch (Exception $ex) { |
| 47 | + echo "Exception Occurred!\n"; |
| 48 | + echo "Code:{$ex->faultcode}\n"; |
| 49 | + echo "String:{$ex->faultstring}\n"; |
| 50 | +}; |
0 commit comments