Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

He said only a small contribution to having to set up a single file. #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions Examples/adddns_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$domain = "somedns.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);
$xmlapi->set_http_client('curl');
$xmlapi->set_port(2086);
$xmlapi->set_debug(1);
Expand Down
7 changes: 2 additions & 5 deletions Examples/addip_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);

Expand Down
7 changes: 2 additions & 5 deletions Examples/api1_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$account = "cptest";
$email_user = "somerandomuser";
$email_password = "adfm90f1m3f0m0adf";
$email_domain = "somedomain.com";
$email_query = '10';

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);
$xmlapi->set_output('json');

$xmlapi->set_debug(1);
Expand Down
7 changes: 2 additions & 5 deletions Examples/api2_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$account = "cptest";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);
$xmlapi->set_output("json");

$xmlapi->set_debug(1);
Expand Down
7 changes: 2 additions & 5 deletions Examples/api2_example_withargs.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$account = "someuser";
$email_account = "randomemail";
$email_domain = "somedomain.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);
print $xmlapi->api2_query($account, "Email", "getdiskusage", array(domain=>$email_domain, login=>$email_account) );
9 changes: 3 additions & 6 deletions Examples/createacct_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
# POSSIBILITY OF SUCH DAMAGE.
include_once '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);

$acct = array( username => "someuser", password => "pass123", domain => "thisdomain.com");
$acct = array( username => "someuser", password => "pass123", domain => "thisdomain.com", plan =>"user_plan_diamond", contactemail=>"[email protected]",language=>"es");
print $xmlapi->createacct($acct);
5 changes: 1 addition & 4 deletions Examples/hashauth_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
# POSSIBILITY OF SUCH DAMAGE.

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');

# The access has can be found on your server under WHM's "Setup remote access hash" section or at /root/.accesshash
$root_hash = '__ROOT_HASH_GOES_HERE__';

$xmlapi = new xmlapi($ip);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->hash_auth("root",$root_hash);
$xmlapi->return_xml(1);
$xmlapi->set_debug(1);
Expand Down
7 changes: 2 additions & 5 deletions Examples/killdns_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$domain = "somedns.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);

Expand Down
7 changes: 2 additions & 5 deletions Examples/listips_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);

Expand Down
7 changes: 2 additions & 5 deletions Examples/listzones_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

include '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi = new xmlapi(SERVER_IP);
$xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);

$xmlapi->set_debug(1);

Expand Down
10 changes: 10 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**************************
* General settings Access *
***************************/

define("ROOT_USER", "user_WHM");// user WHM
define("ROOT_PASSWORD", "PasswordXXX*");// password user WHM
define("SERVER_NAME", $_SERVER['SERVER_NAME']);// name the domain the server WHM, example: domain.com
define("SERVER_IP", $_SERVER['SERVER_ADDR']);// if the script is hosted on the same server whm. (No change) / ip xxx.xxx.xxx.xxx otherwise the WHM
?>
2 changes: 1 addition & 1 deletion xmlapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
* @link http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi
* @since Class available since release 0.1
**/

require_once('config.php');
class xmlapi
{
// should debugging statements be printed?
Expand Down