Giter Club home page Giter Club logo

api-php-lib's Introduction

PHP library for Plesk XML-RPC API

Test Status Scrutinizer Code Quality codecov

PHP object-oriented library for Plesk XML-RPC API.

Install Via Composer

Composer is a preferable way to install the library:

composer require plesk/api-php-lib

Usage Examples

Here is an example on how to use the library and create a customer with desired properties:

$client = new \PleskX\Api\Client($host);
$client->setCredentials($login, $password);

$client->customer()->create([
    'cname' => 'Plesk',
    'pname' => 'John Smith',
    'login' => 'john',
    'passwd' => 'secret',
    'email' => '[email protected]',
]);

It is possible to use a secret key instead of password for authentication.

$client = new \PleskX\Api\Client($host);
$client->setSecretKey($secretKey)

In case of Plesk extension creation one can use an internal mechanism to access XML-RPC API. It does not require to pass authentication because the extension works in the context of Plesk.

$client = new \PleskX\Api\InternalClient();
$protocols = $client->server()->getProtos();

For additional examples see tests/ directory.

How to Run Unit Tests

One the possible ways to become familiar with the library is to check the unit tests.

To run the unit tests use the following command:

REMOTE_HOST=your-plesk-host.dom REMOTE_PASSWORD=password composer test

To use custom port one can provide a URL (e.g. for Docker container):

REMOTE_URL=https://your-plesk-host.dom:port REMOTE_PASSWORD=password composer test

One more way to run tests is to use Docker:

docker-compose run tests

Continuous Testing

During active development it could be more convenient to run tests in continuous manner. Here is the way how to achieve it:

REMOTE_URL=https://your-plesk-host.dom:port REMOTE_PASSWORD=password composer test:watch

api-php-lib's People

Contributors

abashurov avatar ayvazyan10 avatar baldhead avatar davidhdj avatar dependabot[bot] avatar ghermans avatar jb-boin avatar kojhon avatar laurisb avatar mrsombre avatar rybalov avatar sergeimilke avatar sibprogrammer avatar simonsolutions avatar transkontrol avatar vbaranovskiy-plesk avatar vizovitin avatar vlikhtanskiy avatar xgin 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

api-php-lib's Issues

Class "\PleskX\Api\Operator\Customer" not found

Hello, Not sure what I'm doing wrong here but even trying to use the example in the readme file I can't get it to work. Thanks for any help you can provide.
Here's the code:

require_once $path.'/api-php-lib/src/Api/Client.php';
use PleskX\Api\Client;

$host = '***';
$login = '***';
$password = '***';

$client = new \PleskX\Api\Client($host);
$client->setCredentials($login, $password);

$client->customer()->create([
    'cname' => 'Plesk',
    'pname' => 'John Smith',
    'login' => 'john',
    'passwd' => 'secret',
    'email' => '[email protected]',
]);

Mail forwarding

It's some feature to add forwarding when api creates email address, or update it later?

At the moment I edit some your class, and it looks like this:

    /**
     * ...
     * @param string $address
     */
    public function create($name, $siteId, $mailbox = false, $address, $password = '')
    {
        $packet = $this->_client->getPacket(); 

        ...

        if (!empty($address)) {
            $forwarding = $mailname->addChild('forwarding');
            $forwarding->addChild('enabled', 'true');
            $forwarding->addChild('address', $address);
        }

        ...

        $response = $this->_client->request($packet);
        return new Struct\Info($response->mailname);
    }

But in time, my solution is weak. Maybe someone have any alternative option?

Get extenstions git

<packet> <extension> <call> <git> <get/> </git> </call> </extension> </packet>

New release?

Hey, we are planning to use this library in our project FOSSBilling, but seems like some of the new features don't appear yet in the new releases.

We specifically need the setProperties feature. It exists in the master branch but our project has its minimum-stability set to true in the Composer.json file.

Can you give us an ETA for a new release?

How to get siteId for mail()->create()

The siteId is a mandatory field for $client->mail()->create(), yet it seems impossible to get via the api.

The endpoint $client->webspace()->getAll() returns just the contents of /packet/webspace/get/result/data/gen_info information about the site, but skips the site id in
/packet/webspace/get/result/id in the response XML.

So, how do I get the id needed for email account creation (and other site related actions)?


XML response for reference:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
  <webspace>
    <get>
      <result>
        <status>ok</status>
        <filter-id>1</filter-id>
        <id>1</id>
        <data>
          <gen_info>
            <!-- Only (some) contents form here are returned -->
          </gen_info>
        </data>
      </result>
    </get>
  </webspace>
</packet>

Fatal Error when trying to create a customer

When I use the following code:

<?php
error_reporting(-1);
ini_set('display_errors', 'On');
require("../../broomfieldhosting.co.uk/plesk-php-api/src/PleskX/Api/Client.php");
$client = new \PleskX\Api\Client('broomfieldhosting.co.uk');
$client->setCredentials('admin', '***************');

$client->customer()->create([
    'cname' => 'Plesk',
    'pname' => 'John Smith',
    'login' => 'john',
    'passwd' => 'secret',
    'email' => '[email protected]',
]);
?>

I get the error:
Fatal error: Uncaught Error: Class '\PleskX\Api\Operator\Customer' not found in /var/www/vhosts/broomfieldhosting.co.uk/broomfieldhosting.co.uk/plesk-php-api/src/PleskX/Api/Client.php:345 Stack trace: #0 /var/www/vhosts/broomfieldhosting.co.uk/broomfieldhosting.co.uk/plesk-php-api/src/PleskX/Api/Client.php(364): PleskX\Api\Client->_getOperator('Customer') #1 /var/www/vhosts/broomfieldhosting.co.uk/account.broomfieldhosting.co.uk/signup/stevejobs.php(8): PleskX\Api\Client->customer() #2 {main} thrown in /var/www/vhosts/broomfieldhosting.co.uk/broomfieldhosting.co.uk/plesk-php-api/src/PleskX/Api/Client.php on line 345

Unable to make same operator calls to different servers in same script

The operator cache implementation makes it impossible to make the same calls to different servers within the same script. Since the operator cache is listed as a private static variable, the cache exists even for different Client instances. Just making the cache a private variable as opposed to static still gives you the cache ability, while allowing other Client instances to keep track of their own cache and make calls to their respective server.

ampersand in password causes wrong error in rest API

We're implementing some software to manage a bunch of Plesk servers and we're using the REST api. After some trouble that sometimes our generated strong passwords got rejected. We started digging into the logs to find why they were being rejected.

It appears the Plesk Rest API uses this client to forward messages to the XML API. Since the Plesk bug report forums are unavailable to me (I'm not allowed to report anything there for some reason,perhaps because my account is new) I thought i'd at least report the problem here since it is probably also a problem with this client itself.

The problem is caused by the Rest api not encoding the & to &amp; in a password before sending it on to this Client.

Some example logging (with a generated password: &62~?y4J%oUZK8 ):

PHP Warning:  SimpleXMLElement::addChild(): unterminated entity reference   62~?y4J%oUZK8 in /usr/local/psa/admin/plib/modules/rest-api/vendor/plesk/api-php-lib/src/Api/Client.php on line 321
[2021-08-03 12:45:25.819] ERR [extension/rest-api] Do not use quotes, space and national alphabet characters in a password.

the _arrayToXml function seems to be the one ultimately doing this. You could solve this by encoding the ampersand before sending it into simpleXML's addChild.

Perhaps it can be fixed in this client or in the rest api itself (but there is no repo for the rest api for me to report this to) and the php code for the rest api is encrypted on the server.

Please note that the Client adding part of the API suggest the following:

Your password is not complex enough. According to the server policy, the minimal password strength is Strong. To improve the password strength, use numbers, upper and lower-case characters, and special characters like !,@,#,$,%,^,&,*,?,_,~

How do I create single secret key token with multiple IP support?

Hello Team,

I have a requirement where I need to create a secret key to support multiple IP addresses.

Currently, I'm using secretKey()->create($ip) method (defined under PleskX\Api\InternalClient class) to create a secret key. I checked the swagger.yml, we do have /api/v2/auth/keys API wherein we can pass the ips.

So my query is, Do we have any such way to pass multiple IP addresses in secretKey()->create() method?

Note: for single IP create method is working fine, but I'm not sure how can I pass multiple IP addresses.

Thanks

Add Subscription to a User-Account.

Hey, I want to use this for automatic deployment of Webspaces if the User buys a Subscription in my Interface. I've looked trough the tests/ directory and the source but didn't found anything regarding subscribing a user to a Service Plan.
Maybe someone can help me?

PHP warning in subdomain()->getAll() if there are no subdomains

STEPS TO REPRODUCE:
On server without any subdomains run:

$client = new PleskX\Api\Client(...);
var_dump($client->subdomain()->getAll());

And check logs.

ACTUAL RESULT:
PHP Warning: Invalid argument supplied for foreach(); File: /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/plesk/api-php-lib/src/PleskX/Api/Struct/Subdomain/Info.php, Line: 28

And output:

array(1) {
  [0]=>
  object(PleskX\Api\Struct\Subdomain\Info)#297 (4) {
    ["id"]=>
    int(0)
    ["parent"]=>
    string(0) ""
    ["name"]=>
    string(0) ""
    ["properties"]=>
    array(0) {
    }
  }
}

EXPECTED RESULT:
No PHP warning and empty array.

Create subscription for a customer

Hi Guys,

I am trying to use this api. I can create a customer successfuly but I am unable to add a subscription based on my service plans.

Please can someone explain to me how to do this?

Thanks

John

Need help using the api php lib plesk

FR

Bonjour,

Actuellement, j'essaie de comprendre comment la Plesk API PHP LIB fonctionne... Malheureusement sur le github il y a 3 lignes d'explications et après démerder vous.... Quelqu'un serait en mesure de m'aider pour gérer cette librairie php plesk sur mon site svp ?

Cordialement,


EN

Hello,

Currently, I'm trying to understand how the PHP Plesk PHP LIB works ... Unfortunately on the github there are 3 lines of explanations and after demerder you .... Someone would be able to help me to manage this php plesk library on my site please?

Regards,

Retrieve site-id with the site guid

Hi,

not really an issue more a question,
how can i retrieve the site-id (forexample 20) based on the guid (forexample f0bf242345-50ed-4d86-81a3-61f06b12adfd3d0)?

many thanks !

Further Server Statistics

The current server getStatistics function returns only the objects and version data, leaving out the other data like disk space (mainly what I'm after).
Are there any plans to add that remaining server statistics data in future?

notice with failed request

Hi,

I am getting a notice with a seeminlgy failed request:

Notice: Undefined offset: 0 in C:\DEV\sites\tools-si\vendor\plesk\api-php-lib\src\Api\Client.php on line 163

dumping the $xml variable yields the following:
object(PleskX\Api\XmlResponse)[475]
public '@attributes' =>
array (size=1)
'version' => string '1.6.9.0' (length=7)
public 'site' =>
object(PleskX\Api\XmlResponse)[241]
public 'get' =>
object(PleskX\Api\XmlResponse)[474]

there is no 'result' attribute under 'get'

Here's my request:




PARENT_NAME


<gen_info />



<disk_usage />



with PARENT_NAME being the name of a webspace as speciefied by the guide: https://docs.plesk.com/en-US/onyx/api-rpc/about-xml-api/reference/managing-sites-domains/available-filters.66544/

plesk version for this server is 17.0

running with "plesk/api-php-lib": "1.0.4" in composer.json

It would be awesome for all these info to be available with php and not though requests

PHP Version or error repository?

for which version of PHP is it allowed? I am using it in 8.2.9 and when I put the host (ip), username and password it does not generate any client...

require 'inc/core.php';
require 'vendor/autoload.php';

$client = new \PleskX\Api\Client("myip");
$client->setCredentials($s['plesk']['username'], $s['plesk']['password']);

$client->customer()->create([
    'cname' => 'Plesk',
    'pname' => 'John Smith',
    'login' => 'john',
    'passwd' => 'secret',
    'email' => '[email protected]',
]);

Adding multiply ip addresses to a webspace on create

Hey,

today I tried to create a webspace with two IP addresses.
When I tried to pass my IP addresses as an array, I got the following error.

mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: SimpleXMLElement::addChild(): Argument #2 ($value) must be of type ?string, array given in /**/cp/vendor/plesk/api-php-lib/src/Api/Operator/Webspace.php:78

I don't know how to do this as a string, but if any of you know, please give me the solution.

In my opinion this is a bug that can be solved as follows:

We add in Webspace.php:78, before $infoGeneral is added the child, the following query.

 if ($value == $properties['ip_address'])
                continue;

According to my research $infoGeneral does not need this information.
The IP addresses are added a bit later.

So in my case the method now looks like this:
PleskX\Api\Operator\Webspace

namespace PleskX\Api\Operator
    /**
     * @param array $properties
     * @param array|null $hostingProperties
     * @param string $planName
     *
     * @return Struct\Info
     */
    public function create(array $properties, array $hostingProperties = null, string $planName = ''): Struct\Info
    {
        $packet = $this->client->getPacket();
        $info = $packet->addChild($this->wrapperTag)->addChild('add');

        $infoGeneral = $info->addChild('gen_setup');
        foreach ($properties as $name => $value) {
            if ($value == $properties['ip_address'])
                continue;
            $infoGeneral->addChild($name, (string) $value);
        }

        if ($hostingProperties) {
            $infoHosting = $info->addChild('hosting')->addChild('vrt_hst');
            foreach ($hostingProperties as $name => $value) {
                $property = $infoHosting->addChild('property');
                $property->name = $name;
                $property->value = $value;
            }

            if (isset($properties['ip_address'])) {
                foreach ((array) $properties['ip_address'] as $ipAddress) {
                    $infoHosting->addChild('ip_address', $ipAddress);
                }
            }
        }

        if ('' !== $planName) {
            $info->addChild('plan-name', $planName);
        }

        $response = $this->client->request($packet);

        return new Struct\Info($response, $properties['name'] ?? '');
    }

Adjust access modifier on Client class methods

The PleskX\Api\Client class has a fair amount of methods and properties with a private access modifier. Consider changing it to protected.

I would like to extend the class and adjust a few lines in one of the methods. But currently it's a pain in the butt because most methods/properties are declared as private.

Release tagging

Dear maintainer,

Would you mind to please tag releases? We're dependent on dev-master 0f080c6 at this moment,
but I would appreciate to see release tags for new versions. So we don't have to pull directly from the repo like this.

Thanks in advance,
Ramon

Multiple Site Alias request returns insufficient error content

In setting up some tools to 'bulk-manage' site aliases, it appears that when I make a request to get Info for multiple Site Aliases and one of them doesn't exist, I get a generic, singular, and somewhat malformed result. Examples below:

There were four aliased subdomains on qa.domain.com. The last two aliases have been removed prior to this test.

REQUEST

<packet>
    <site-alias>
        <get>
            <filter>
                <name>alias-02.qa.domain.com</name>
                <name>alias-03.qa.domain.com</name>
                <name>alias-04.qa.domain.com</name>
                <name>alias-05.qa.domain.com</name>
            </filter>
        </get>
    </site-alias>
</packet>

RESPONSE (in JSON for readability)

{
    "success": false,
    "domain": "..domain.com",
    "message": "Domain alias does not exist"
}

The domain element is malformed, and it neither gives me the info that it can get on the existing aliases, nor does it tell me which aliases, if any, do not exist.

I can work around this by making discrete calls to see which fail, but cringe at the wasted overhead and time to set this up.

TypeError when calling get() with no results

The Site::get() method is type hinted to always return a GeneralInfo struct, but it just mindlessly returns the result from reset($items), which returns false when the array is empty.

Furthermore, it seems quite unhelpful to get multiple results back from the API and then just returning the first one. Considering this is already published as a public interface, I would suggest making the return type nullable and then changing return reset($items); to return reset($items) ?: null. Then add some kind of method that would return all results and call it find, search or something like that.

That way it should be possible to remedy the issue without breaking compatibility (Beyond people working around the issue by catching the TypeError that arises when there are no results).

PHP Fatal error:  Uncaught TypeError: PleskX\Api\Operator\Site::get(): Return value must be of type PleskX\Api\Struct\Site\GeneralInfo, bool returned in ~/Git/project/vendor/plesk/api-php-lib/src/Api/Operator/Site.php:61
Stack trace:
#0 ~/Git/project/init.php(11): PleskX\Api\Operator\Site->get()
#1 {main}
  thrown in ~/Git/project/vendor/plesk/api-php-lib/src/Api/Operator/Site.php on line 61

get all properties of subscriptions

Hi,
in general, the API is just returning the gen_info tags mostly, there is no way of getting a full subscription, e.g. with a packet:

<packet>
	<webspace>
		<get>
			<filter/>
			<dataset>
				<gen_info/>
				<hosting/>
				<stat/>
				<prefs/>
				<disk_usage/>
				<performance/>
				<subscriptions/>
				<php-settings/>
				<resource-usage/>
			</dataset>
		</get>
	</webspace>
</packet>

Is there any plan to extend the API to really receive all properties, or a way to customize it without re-programming nearly the whole API?

@abashurov , any idea?

Installed with composer 1.1.3 but didn't get latest changes

Running php 7.4.

I got this in composer.json:

"plesk/api-php-lib": "^1.1",

And this is a block of composer.lock:

{
            "name": "plesk/api-php-lib",
            "version": "v1.1.3",
            "source": {
                "type": "git",
                "url": "https://github.com/plesk/api-php-lib.git",
                "reference": "561190e38da5f4937b674ba05912b73615f8d079"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/plesk/api-php-lib/zipball/561190e38da5f4937b674ba05912b73615f8d079",
                "reference": "561190e38da5f4937b674ba05912b73615f8d079",
                "shasum": ""
            },
            "require": {
                "ext-curl": "*",
                "ext-simplexml": "*",
                "ext-xml": "*",
                "php": "^7.3 || ^8.0"
            },
            "require-dev": {
                "phpunit/phpunit": "^9",
                "spatie/phpunit-watcher": "^1.22"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "2.0.x-dev"
                }
            },
            "autoload": {
                "psr-4": {
                    "PleskX\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "Apache-2.0"
            ],
            "authors": [
                {
                    "name": "Alexei Yuzhakov",
                    "email": "[email protected]"
                },
                {
                    "name": "Plesk International GmbH.",
                    "email": "[email protected]"
                }
            ],
            "description": "PHP object-oriented library for Plesk XML-RPC API",
            "support": {
                "issues": "https://github.com/plesk/api-php-lib/issues",
                "source": "https://github.com/plesk/api-php-lib/tree/v1.1.3"
            },
            "time": "2022-03-29T08:00:36+00:00"
        }

So I should get the latest code right? Well, this is the latest:

<?php
// Copyright 1999-2022. Plesk International GmbH.

namespace PleskX\Api\Struct\Site;

use PleskX\Api\AbstractStruct;

class GeneralInfo extends AbstractStruct
{
    public int $id;
    public string $creationDate;
    public string $name;
    public string $asciiName;
    public string $guid;
    public string $status;
    public int $realSize;
    public array $ipAddresses = [];
    public string $description;
    public string $webspaceGuid;
    public int $webspaceId;

    public function __construct(\SimpleXMLElement $apiResponse)
    {
        $this->initScalarProperties($apiResponse, [
            ['cr_date' => 'creationDate'],
            'name',
            'ascii-name',
            'status',
            'real_size',
            'guid',
            'description',
            'webspace-guid',
            'webspace-id',
        ]);

        foreach ($apiResponse->dns_ip_address as $ip) {
            $this->ipAddresses[] = (string) $ip;
        }
    }
}

And this is what I have in vendors:

<?php
// Copyright 1999-2021. Plesk International GmbH.

namespace PleskX\Api\Struct\Site;

class GeneralInfo extends \PleskX\Api\Struct
{
    /** @var string */
    public $name;

    /** @var string */
    public $asciiName;

    /** @var string */
    public $guid;

    /** @var string */
    public $status;

    /** @var string */
    public $description;

    public function __construct($apiResponse)
    {
        $this->_initScalarProperties($apiResponse, [
            'name',
            'ascii-name',
            'status',
            'guid',
            'description',
        ]);
    }
}

So looks like for some reason even if I've installed latest release, does not contain the new code with the site id field that I need.

Any ideas? I'll try to install as git repo..

ownership problem

I create an automatic subdomain, but the file ownership is "10015 swkey-dat". After the domain is created, I want to clone the github repo, but the files are not copied due to the file ownership issue. What can I do to change the file ownership to www-data?

How to set/update/change customer|webspace... values?

Hello people, it's great your project!
I have a question, sorry if possible stupid question but i cant change any created value... for example update|change customer email's etc...

I'm trying to set|update values of customer/webspace....

I know method of create, get and delete, but i can't change any existent value... ¿what is set/update/change method?
$this_client = $client->customer()->get('id', {ID_HERE} );

$this_client->set('email', '[email protected]'); ??

Thanks and regards!

Updates

Any plans to update this library?

Onyx releasing around the corner with new features. Would be nice to take advantage of new API calls.

How to get all subscriptions of a particular user?

Hello!

$client->webspace()->get('owner-guid', 'xxxxx')

returns only one result, althouth there could be more. Is there any way to get all user's subscriptions via API call?

I see Plesk returns the proper result with more records, but Operator _getItems method seems to take only the first one.

Thank you!

PHP 8 compatibility

Hello,

the current version can not be installed on PHP 8. In the composer.json the PHP Version is limited to "^7.3".

So when is a PHP 8 compatibility planned?

Thanks.

Check if webspace exists

Hello,
is there a better solution than using try-catch to see if a webspace exists? Currently I do it this way:

try {
    $client->webspace()->get('name', 'something')
    // Webspace exists
} catch (PleskX\Api\Exception $e) {
    // Webspace does not exists
}

But the problem is that every exception is catched (be it due to server errors or wrong parameters / filters).

How to create subdomain with DSMail enabled

Creating a subdomain works, but can not found how to enable DSMail for this domain.
I want to create a email address direct after creating the subdomain.
But reaching this PleskX\Api\Exception : There is no DSMail service for domain with id = 3

Attempt to read property "pname" on null

When requesting all resellers from a server that doesn't have resellers enabled (Plesk Web Pro edition) I'm getting this error:

$client->reseller()->getAll(); // Attempt to read property "pname" on null

I expect this to just return an empty array since there are no resellers.

PHP: 8.1.6
Laravel: 9.19.0
plesk/api-php-lib: 1.1.3

site()->getAll() causes an exception

Calling site()->getAll() causes an exception

   ErrorException

  Trying to get property 'name' of non-object

  at vendor\plesk\api-php-lib\src\Api\Struct.php:29
    25|                 $classPropertyName = current($property);
    26|                 $value = $apiResponse->{key($property)};
    27|             } else {
    28|                 $classPropertyName = $this->_underToCamel(str_replace('-', '_', $property));
  > 29|                 $value = $apiResponse->$property;
    30|             }
    31|
    32|             $reflectionProperty = new \ReflectionProperty($this, $classPropertyName);
    33|             $docBlock = $reflectionProperty->getDocComment();

  1   vendor\plesk\api-php-lib\src\Api\Struct.php:29
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Trying to get property 'name' of non-object", "vendor\plesk\api-php-lib\src\Api\Struct.php", ["name", "name"])

  2   vendor\plesk\api-php-lib\src\Api\Struct\Site\GeneralInfo.php:27
      PleskX\Api\Struct::_initScalarProperties()

Authentication via secret key. This happens both on last stable and dev-master. PHP 7.4
Plesk Obsidian
Version 18.0.29 Update #2

Plesk error [11003]:

Plesk error [11003]: PleskAPIInvalidSecretKeyException : Invalid secret key usage. Please check logs for details.

I get this error while migrating a subscription between plesk servers.

More webspace information

Hello!

Is there a proper way to get more webspace information than defined in PleskX/Api/Struct/Webspace/GeneralInfo.php ? There are only two pieces of information in there currently.

[Suggestion] - README.md needs documentation

At this point It isn't at all obvious for everyone how to start using this package.
For that i would like to suggest to add a minimum set of examples demonstrating how to use this package.

Class "pm_ApiRpc" not found

Hey,

I have this error :/
Fatal error: Uncaught Error: Class "pm_ApiRpc" not found in /var/www/vhosts/yrup.tk/httpdocs/plesk-api/src/Api/Client.php:172 Stack trace: #0 /var/www/vhosts/yrup.tk/httpdocs/plesk-api/src/Api/Operator/Server.php(15): PleskX\Api\Client->request() #1 /var/www/vhosts/yrup.tk/httpdocs/index.php(6): PleskX\Api\Operator\Server->getProtos() #2 {main} thrown in /var/www/vhosts/yrup.tk/httpdocs/plesk-api/src/Api/Client.php on line 172

This is my code :

<?php
ini_set("display_errors", 1);
require_once("plesk-api/vendor/autoload.php");

$client = new \PleskX\Api\InternalClient();
$protocols = $client->server()->getProtos();

print_r($protocols);

Where is the problem ?

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.