From 90dacef2be039183dfa1c332fd74944a02611f4a Mon Sep 17 00:00:00 2001 From: Deltik Date: Wed, 7 Feb 2018 17:25:52 -0600 Subject: [PATCH] Fixed mangling of POST data And removed pointless and problematic print() call And improved formatting in README.md --- README.md | 12 ++++++------ cpaneluapi.class.php | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 268fb52..3ccea1d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -##cPanel UAPI and API2 PHP class +## cPanel UAPI and API2 PHP class PHP class to provide an easy to use interface with cPanel’s UAPI and API2. Uses php magic functions to provide a simple and powerful interface. @@ -7,16 +7,16 @@ v2.0 is not backwards compatible, and will likley under go a few more changes, s The class has been renamed to cpanelAPI. Some more testing is required. -##Usage +## Usage See the example files, but typical useage takes the form of: -###Instantiate the class +### Instantiate the class ``` $capi = new cpanelAPI('user', 'password', 'cpanel.example.com'); ``` The API we want to use and the Module (also called Scope) are now protected and are set by `__get()`. -The request layout looks like this: $capi->api->Module->request(args[]) +The request layout looks like this: `$capi->api->Module->request(args[])` For example. We want to use the UAPI to call the Mysql get_restrictions function. ``` @@ -32,12 +32,12 @@ $response = $capi->create_database(['name' => $capi->user.'_MyDatabase']); print_r($response); ``` -we can also change the scope without respecifying the api, note that the Module call is case sensative. +we can also change the scope without respecifying the api, note that the Module call is case-sensitive. ``` $response = $capi->SSL->list_certs(); ``` -###API2 +### API2 API2 is used in exactly the same way as the UAPI ``` diff --git a/cpaneluapi.class.php b/cpaneluapi.class.php index ddc3ec7..af6bf5f 100644 --- a/cpaneluapi.class.php +++ b/cpaneluapi.class.php @@ -179,10 +179,9 @@ protected function APIcall($name, $arguments) $this->requestUrl .= http_build_query($arguments); } if($this->httpMethod == 'POST'){ - $this->postData = http_build_query($arguments); + $this->postData = $arguments; } - print $this->postData; return $this->curl_request($this->requestUrl); }