From bade408e83318a685c7ee91ea68855a9d1606250 Mon Sep 17 00:00:00 2001 From: Glenn Hermans Date: Mon, 14 Nov 2016 19:40:25 +0100 Subject: [PATCH 1/5] Update GeneralInfo.php Added more information to display --- .../Api/Struct/Customer/GeneralInfo.php | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/PleskX/Api/Struct/Customer/GeneralInfo.php b/src/PleskX/Api/Struct/Customer/GeneralInfo.php index 0296446c..f49e850f 100644 --- a/src/PleskX/Api/Struct/Customer/GeneralInfo.php +++ b/src/PleskX/Api/Struct/Customer/GeneralInfo.php @@ -20,6 +20,27 @@ class GeneralInfo extends \PleskX\Api\Struct /** @var string */ public $email; + /** @var string */ + public $phone; + + /** @var string */ + public $fax; + + /** @var string */ + public $address; + + /** @var string */ + public $pcode; + + /** @var string */ + public $city; + + /** @var string */ + public $state; + + /** @var string */ + public $country; + /** @var string */ public $description; @@ -34,8 +55,15 @@ public function __construct($apiResponse) 'login', 'guid', 'email', + 'phone', + 'fax', + 'address', + 'pcode', + 'city', + 'state', + 'country', 'external-id', 'description', ]); } -} \ No newline at end of file +} From 326bc6c8533f18f86d909b545de1a9190cae119f Mon Sep 17 00:00:00 2001 From: Glenn Hermans Date: Mon, 14 Nov 2016 21:53:15 +0100 Subject: [PATCH 2/5] Added examples section to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e282d949..45c4aec1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ PHP object-oriented library for Plesk XML-RPC API. `composer require plesk/api-php-lib:@dev` +## Examples + +To get started you can find examples in the 'examples' folder or open [index.html](index.html) + ## How to Run Unit Tests One the possible ways to become familiar with the library is to check the unit tests. From 8e1a2116c264bb2859036b21df38cc602a590dbb Mon Sep 17 00:00:00 2001 From: Glenn Hermans Date: Mon, 14 Nov 2016 22:02:27 +0100 Subject: [PATCH 3/5] Added basic examples --- examples/customers/createCustomer.php | 41 ++++++++++++ examples/customers/getCustomers.php | 26 ++++++++ examples/index.html | 0 examples/server/getGeneralInfo.php | 26 ++++++++ examples/server/getKeyInfo.php | 26 ++++++++ examples/server/getServiceStates.php | 26 ++++++++ examples/server/getStatistics.php | 26 ++++++++ examples/server/getUpdatesInfo.php | 26 ++++++++ examples/serviceplans/getServiceplans.php | 26 ++++++++ examples/sites/getSites.php | 26 ++++++++ index.html | 79 +++++++++++++++++++++++ 11 files changed, 328 insertions(+) create mode 100644 examples/customers/createCustomer.php create mode 100644 examples/customers/getCustomers.php create mode 100644 examples/index.html create mode 100644 examples/server/getGeneralInfo.php create mode 100644 examples/server/getKeyInfo.php create mode 100644 examples/server/getServiceStates.php create mode 100644 examples/server/getStatistics.php create mode 100644 examples/server/getUpdatesInfo.php create mode 100644 examples/serviceplans/getServiceplans.php create mode 100644 examples/sites/getSites.php create mode 100644 index.html diff --git a/examples/customers/createCustomer.php b/examples/customers/createCustomer.php new file mode 100644 index 00000000..84a114f5 --- /dev/null +++ b/examples/customers/createCustomer.php @@ -0,0 +1,41 @@ +setCredentials($login, $password); + + try { + $customer = $client->customer()->create(array( + 'cname' => 'Example', + 'pname' => 'Example customer', + 'login' => 'example', + 'passwd' => 'Jhtr66fBB', + 'status' => '0', + 'phone' => '416 907 9944', + 'fax' => '928 752 3905', + 'email' => 'demo@example.com', + 'address' => '105 Brisbane Road, Unit 2', + 'city' => 'Toronto', + 'state' => '', + 'pcode' => '', + 'country' => 'CA' + )); + + // Show result + echo "
";
+     print_r($customer);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please verify your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/customers/getCustomers.php b/examples/customers/getCustomers.php new file mode 100644 index 00000000..b55e5d41 --- /dev/null +++ b/examples/customers/getCustomers.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $customer = $client->customer()->getAll(); + // Show result + echo "
";
+     print_r($customer);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 00000000..e69de29b diff --git a/examples/server/getGeneralInfo.php b/examples/server/getGeneralInfo.php new file mode 100644 index 00000000..4477e279 --- /dev/null +++ b/examples/server/getGeneralInfo.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $server = $client->server()->getGeneralInfo(); + // Show result + echo "
";
+     print_r($server);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/server/getKeyInfo.php b/examples/server/getKeyInfo.php new file mode 100644 index 00000000..d83e12dc --- /dev/null +++ b/examples/server/getKeyInfo.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $server = $client->server()->getKeyInfo(); + // Show result + echo "
";
+     print_r($server);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/server/getServiceStates.php b/examples/server/getServiceStates.php new file mode 100644 index 00000000..a81caaaa --- /dev/null +++ b/examples/server/getServiceStates.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $server = $client->server()->getServiceStates(); + // Show result + echo "
";
+     print_r($server);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/server/getStatistics.php b/examples/server/getStatistics.php new file mode 100644 index 00000000..25aa5523 --- /dev/null +++ b/examples/server/getStatistics.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $stats = $client->server()->getStatistics(); + // Show result + echo "
";
+     print_r($stats);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/server/getUpdatesInfo.php b/examples/server/getUpdatesInfo.php new file mode 100644 index 00000000..1eb0f9c9 --- /dev/null +++ b/examples/server/getUpdatesInfo.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $update = $client->server()->getUpdatesInfo(); + // Show result + echo "
";
+     print_r($update);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/serviceplans/getServiceplans.php b/examples/serviceplans/getServiceplans.php new file mode 100644 index 00000000..f56c0f52 --- /dev/null +++ b/examples/serviceplans/getServiceplans.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $packages = $client->serviceplan()->getAll(); + // Show result + echo "
";
+     print_r($packages);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/examples/sites/getSites.php b/examples/sites/getSites.php new file mode 100644 index 00000000..9023825b --- /dev/null +++ b/examples/sites/getSites.php @@ -0,0 +1,26 @@ +setCredentials($login, $password); + + try { + $site = $client->site()->getAll(); + // Show result + echo "
";
+     print_r($site);
+     echo "
"; + } catch (\PleskX\API\Client\Exception $e) { + echo 'Please check your credentials. Make sure to change the $host, $login, and $password variables in this file.'; + } diff --git a/index.html b/index.html new file mode 100644 index 00000000..0057d9e8 --- /dev/null +++ b/index.html @@ -0,0 +1,79 @@ + + + + + + + + + + Plesk - PHP library for XML-RPC API + + + + +
+
+
+ +
+
+ +
+
+

We have added some coding examples in the `examples` folder to help you getting started.

+
 
+ Customers + + + Sites + + + Service plans + + + Server + +
 
+
+
+ +
+

Copyright 1999-2016. Parallels IP Holdings GmbH

+
+
+ + From 2637cee96e5ac9cddd8e99c27344e9fb9e1652bf Mon Sep 17 00:00:00 2001 From: Glenn Hermans Date: Mon, 14 Nov 2016 22:15:22 +0100 Subject: [PATCH 4/5] quick update --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 0057d9e8..926e04f6 100644 --- a/index.html +++ b/index.html @@ -41,7 +41,8 @@
-

We have added some coding examples in the `examples` folder to help you getting started.

+

We have added some coding examples in the `examples` folder to help you getting started.
+ You will need to change the host, login and password in each file before you can use these examples.

 
Customers