Coder Social home page Coder Social logo

xmlapi-php's Introduction

cPanel API PHP Class

This is an obsolete package for interacting with the cPanel & WHM API. It is no longer updated.

As of version 74, the XML serialization is no longer available in cPanel & WHM. However, despite the name of this package and the fact that it is obsolete, it should be possible to use this package with the JSON serialization (and only the JSON serialization) in version 74 and newer.

xmlapi-php's People

Contributors

cpanelruth avatar davidneimeyer avatar harrybailey avatar sfbee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmlapi-php's Issues

Small typo with XMLAPI_USE_SSL

Just downloaded the latest version, and found this little bug on line 238:

if ( defined('XMLAPI_USER_SSL' ) && (XMLAPI_USE_SSL == '0' ) ) {

XMLAPI_USER_SSL should be XMLAPI_USE_SSL.

Email::getdiskusage

I'm doing tests with the xmlapi.php and trying to use the getdiskusage function

The documentation http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiEmail#Email::getdiskusage says that the input parameters are domain and login but didn't work when trying to acces

$opts = array(
    'domain' => "domain.com",
    'login' => "mail-user",
);

print $xmlapi->api2_query($server_login, "Email", "getdiskusage", $opts);

Returns:

{
    cpanelresult: {
        data: [
              {
                  user: null,
                  domain: "domain.com",
                  login: null,
                  diskused: "0"
               }
           ],
          module: "Email",
          apiversion: 2,
          func: "getdiskusage",
          event: { 
               result: 1
         } 
    }
}

But when i use the paramters user instead of login it works OK

Update the XML-api source code

The current source code of this repository is based on API0 of Cpanel documentation.

I would like to request that we should start the creating the PHP class that is base on API1 of CPanel. There have been a lot of new features of API1 in comparison to API0. It would help a lot of developers if there's a source code for XML-API1.

setresellersips function broken

Hi there,

This is technically a cPanel bug, but something that can be addressed in the xmlapi-php code in the meantime.

Attempting the following code seems to work, doesn't return an error or invalid code, but does not work correctly:

$xmlapi->setresellerips($reseller, $ipaddress);

That is, if you verify the result in WHM by selecting the reseller and their IP allocation, it is incorrect. The API documentation mentions that the IP addresses must be separated by a comma. Even if you are only passing a single value, the API seems to want this to end in a comma. Our workaround is as follows:

$xmlapi->setresellerips($reseller, $ipaddress . ",");

Cheers.

Add AddonDomain

$xmlapi->api2_query($data->products->product[0]->username, "AddonDomain", "addaddondomain", array('newdomain'=>$domainlist[$i])); <- executed

Result is:

object(SimpleXMLElement)#9 (6) {
["apiversion"]=>
string(1) "2"
["data"]=>
object(SimpleXMLElement)#10 (2) {
["reason"]=>
string(76) "You have exceeded the maximum allowed FTP (File Transfer Protocol) accounts."
["result"]=>
string(1) "0"
}
["error"]=>
string(76) "You have exceeded the maximum allowed FTP (File Transfer Protocol) accounts."
["event"]=>
object(SimpleXMLElement)#8 (1) {
["result"]=>
string(1) "1"
}
["func"]=>
string(14) "addaddondomain"
["module"]=>
string(11) "AddonDomain"
}

How to tell the API to not create ftp-accounts?

api2_query listdbs filter does not work

this is the code i am using to find if there is a db called "testing" for the "x" account .. the pb is that everytime it lists all dbs for this account ... am i doing something wrong?

$xmlapi = new xmlapi($ip);
$xmlapi->hash_auth("root",$root_hash);
$xmlapi->set_output('array');
$xmlapi->set_debug(1);

echo '

';
$arrCheck = $xmlapi->api2_query("x", "MysqlFE", "listdbs", array("db"=>"testing"));
print_r($arrCheck);
die();

thanks,
Rares

Subdomain creation using php

Hello, this is what i want.

I have two domains in godadday hosting

firstdomain

seconddomain

I have this code running in firstdomain but i wanna create sub-domain for second domain using following code.

$cpanelusr = 'username';
$cpanelpass = 'password';
$xmlapi = new xmlapi('seconddomain.com');
$xmlapi->set_port( 2083 );
$xmlapi->password_auth($cpanelusr,$cpanelpass);
$xmlapi->set_debug(1); //output actions in the error log 1 for true and 0 false
$result
= $xmlapi->api2_query($cpanelusr, 'SubDomain', 'addsubdomain',
array("$subdomain_name",'seconddomain.com',0,0,
'/public_html/project3/user'));

I am getting this error "curl_exec threw error "couldn't connect to host".............."

Exec Addsubdomain and save file

When I exec script below, And php will show save file windows, How close it?
$cpanelusr = ''; //username cpanel
$cpanelpass = ''; //password cpanel
$domainroot = 'XXX.com.tw'; //root domain
$subdomain = 'TEST'; //sudomain
$xmlapi = new xmlapi('localhost'); //link cpanel (can use ip)
//create_subdomain($domain,$xmlapi); //
$xmlapi->set_output('array');
$xmlapi->set_port( 2083 ); //port cpanel
$xmlapi->password_auth($cpanelusr,$cpanelpass);
$xmlapi->set_debug(1); //output actions in the error log 1 for true and 0 false
file_get_contents($xmlapi->api1_query($cpanelusr, 'SubDomain', 'addsubdomain', array($subdomain, $domainroot,0,0, "/public_html/")));

Function addsubdomain running twice

When i run the below code, xmlapi-php is running twice.

    require_once('../xmlapi.php');

    $cpanelUser = 'user';
    $cpanelPass = 'password';

    $XmlApi = new xmlapi('127.0.0.1');
    $XmlApi->set_port(2083);
    $XmlApi->password_auth($cpanelUser, $cpanelPass);
    $XmlApi->set_debug(1);

    $result = $XmlApi->api2_query($cpanelUser, 'SubDomain', 'addsubdomain', [
        'domain'      => 'marcio',
        'rootdomain'  => 'evoimobdev.com.br',
        'dir'         => '/usersite/marcio/public_html'
    ]);

So i get this result:

[14-Nov-2016 16:53:02 America/Sao_Paulo] URL: https://127.0.0.1:2083/xml-api/cpanel
[14-Nov-2016 16:53:02 America/Sao_Paulo] DATA: domain=marcio&rootdomain=evoimobdev.com.br&dir=%2Fusersite%2Fmarcio%2Fpublic_html&cpanel_xmlapi_user=imobevodev&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2
[14-Nov-2016 16:53:02 America/Sao_Paulo] Authentication Header: Authorization: Basic **hidden**


[14-Nov-2016 16:53:02 America/Sao_Paulo] RESPONSE:
 <?xml version="1.0" ?>
  <cpanelresult>
	<apiversion>2</apiversion>
	<data>
	  <reason>The subdomain “marcio.evoimobdev.com.br” has been added.</reason>
	  <result>1</result>
	</data>
	<event>
	  <result>1</result>
	</event>
	<func>addsubdomain</func>
	<module>SubDomain</module>
  </cpanelresult>

[14-Nov-2016 16:53:02 America/Sao_Paulo] SimpleXML var_dump:
SimpleXMLElement Object
(
	[apiversion] => 2
	[data] => SimpleXMLElement Object
		(
			[reason] => The subdomain “marcio.evoimobdev.com.br” has been added.
			[result] => 1
		)

	[event] => SimpleXMLElement Object
		(
			[result] => 1
		)

	[func] => addsubdomain
	[module] => SubDomain
)

[14-Nov-2016 16:53:04 America/Sao_Paulo] URL: https://127.0.0.1:2083/xml-api/cpanel
[14-Nov-2016 16:53:04 America/Sao_Paulo] DATA: domain=marcio&rootdomain=evoimobdev.com.br&dir=%2Fusersite%2Fmarcio%2Fpublic_html&cpanel_xmlapi_user=imobevodev&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2
[14-Nov-2016 16:53:04 America/Sao_Paulo] Authentication Header: Authorization: Basic **hidden**


[14-Nov-2016 16:53:04 America/Sao_Paulo] RESPONSE:
 <?xml version="1.0" ?>
  <cpanelresult>
	<apiversion>2</apiversion>
	<data>
	  <reason>(XID y945bg) A DNS entry for the domain “marcio.evoimobdev.com.br” already exists.</reason>
	  <result>0</result>
	</data>
	<error>(XID y945bg) A DNS entry for the domain “marcio.evoimobdev.com.br” already exists.</error>
	<event>
	  <result>1</result>
	</event>
	<func>addsubdomain</func>
	<module>SubDomain</module>
  </cpanelresult>

[14-Nov-2016 16:53:04 America/Sao_Paulo] SimpleXML var_dump:
SimpleXMLElement Object
(
	[apiversion] => 2
	[data] => SimpleXMLElement Object
		(
			[reason] => (XID y945bg) A DNS entry for the domain “marcio.evoimobdev.com.br” already exists.
			[result] => 0
		)

	[error] => (XID y945bg) A DNS entry for the domain “marcio.evoimobdev.com.br” already exists.
	[event] => SimpleXMLElement Object
		(
			[result] => 1
		)

	[func] => addsubdomain
	[module] => SubDomain
)

Someone knows why xmlapi-php is running twice?

Composer

So this repository is missing a composer.json file. It would be nice if it can be added. Nobody likes downloading individual files this days.

Password strength test?

I know this is a question an not an issue but im unsure where else to ask so apologies for that.

Trying to use this for the first time an a common problem for me is my randomly generated password does not reach the required strength of 100.

Is there a way to make use of WHM's generate password or to check the strength of the password before trying to create the new cpanel account?

Or a method to produce a strong password that is going to pass everytime?

Thanks all.

addsubdomain

This is a important feature that in this module could be implement.

For windows server

This api is nicely working on Linux hosting but it is not working on windows hosting...

::EditZone / Permission / 200k+ domains

Hi All,
Thanks for this library.
I've created a system, it runs in-house in the company I work for, it manages 200k+ domains, a portion
of these domains are delegated to a cpanel/whm instance - about 30k of 'em; interaction is via
cpanel api2 ( xmlapi-php ) .. we have been facing a problem where in many instances
the DNS Edit ( read and edit ) falls to "You do not have permission to read this zone" ..
-it is not related to the permission of "Advanced DNS Zone Edit feature/package"
( unless it's an unix permission, ? )
-There is only ONE username/account in cpanel that owns it.

Given that this is an exception instance [ all domains are owned by the same entity ], this is my question:

How can we bypass this problem ? Can we somehow chmod +x ( or alike ) a path ? or
which validation this is really doing ? root via whm user:2087 doesnt help ..

We have full control of the server (it's physically local, the server ! ) - ..

Before we write a from-scratch/apache fetching DNS Zone workaround, I really, really wonder:

can we not bypass this somehow ?

any help greatly appreciated !

txs,
s

parameters for addzonrecord

I have read the documentation for cPanel_XMLAP_Client_Class addzonerecord() . I am relatively new to the concept of editing dns settings. It gives the required parameters as :
* @param string $zone The DNS zone that you want to add the record to
* @param array $args Associative array representing the record to be added
What is the name of the zone record so as I can use it as a parameter?
and:
Where can I get a list of the required fields and their format for the array?
for example is this the right idea? or close to it?

I have searched the cPanel documentation but have been unable to come up with an answer.

excuse me.

Why do I give a file as you do?
It has an error
In the 233 line

Forgot to add
Is createacct_example.php
There will be errors

Addition to add setdefaultaddress function

Hello,

I've added a function to the xmlapi file which sets a default e-mail address to forward e-mail to. What is the best way for me to contribute to this file?

Thanks,
LS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.