pmill / php-plesk Goto Github PK
View Code? Open in Web Editor NEWA PHP client for the Plesk RPC API.
A PHP client for the Plesk RPC API.
The API function UpdateEmailPassword :
$params = array(
'email'=>'[email protected]',
'password'=>'areallylongstringwithsomenumbers2',
);
new \pmill\Plesk\UpdateEmailPassword($config, $params);
Doesn't work with me. Please help anything wrong?
Regards,
hello
when i use the example it comes this error:
[Thu May 12 13:14:27 2016] [error] [client 91.190.19.133] PHP Fatal error: Uncaught exception 'pmill\\Plesk\\ApiRequestException' with message 'Error: Incorrect request parameters submitted' in php/plesk/alias/src/pmill/Plesk/BaseRequest.php:31\nStack trace:\n#0 /php/plesk/alias/src/pmill/Plesk/DeleteSiteAlias.php(33): pmill\\Plesk\\BaseRequest->__construct(Array, Array)\n#1 /php/plesk/alias/aliasdel.php(9): pmill\\Plesk\\DeleteSiteAlias->__construct(Array, Array)\n#2 {main}\n thrown in /php/plesk/alias/src/pmill/Plesk/BaseRequest.php on line 31
How to fix this error ?
the example looks like an subdomain
$params = array( 'alias'=>'testalias2.example.com', );
how to insert a alias domain ? test.com doesnt work.
Hi All.
I was creating subdomain on Plesk 12.5.30 version with api:
https://github.com/pmill/php-plesk
After filling up all data it brings error in plesk:
New configuration files for the Apache web server were not created due to the errors in configuration templates: Template processing failed: file = /opt/psa/admin/conf/templates/default/domainVhost.php, error = Template_Exception: Empty content was provided for config file /var/www/vhosts/system/a22.ubicross.me/conf/httpd.conf file: /opt/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 47 code: 0. Detailed error descriptions were sent to you by email. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files. See the details in Configuration Troubleshooter
Can someone navigate me what is the issue I have tried all. Subdomain is creating without problem when you make it from admin but with script I got that issue.
Mention: Everything is set as it mentioned in php-plesk.
Is the option available to create sessions so that clients can login with just one-click?
The API from Plesk supports this option but cannot find it inside this API.
README.md says
Requirements
This library package requires PHP 5.4 or later and Plesk 12.0 or above.
composer.json says
"require": {
"php": ">=5.3.0"
}
So which one is it, does it require PHP >=5.3 or >=5.4? Either way, the version numbers should be updated to match.
First of all, thanks for this awesome module!
I'm listing my subscriptions at this moment, but I would like to receive the service plan too (or at least the name of the plan).
Is there any way to do this?
I can provide you access to a free Plesk 12.5 server for a while if you'd like to update this. I work in hosting, currently developing against the API for a project.
enable and disable email
set or (disable/enable) webmail
I'm gettting a bad gateway after every successfull call. The action is submitted
It is much easier to process exceptions with integer error codes sent by plesk api. Unfortunately they were missed. I have no time right now to fix it everywhere - I needed just one function/class to work properly. Solution to that problem is to fix checkResponse in all classes derived from BaseRequest. Below is example (with added code in bold):
private function checkResponse(\SimpleXMLElement $response) {
if ($response->system->status == 'error') {
throw new ApiRequestException("Error: " . $response->system->errtext**, (int)$response->system->errcode** );
}
}
Hi
How to create autologin link?
As a developer I'd like to have access to a subscription's status in the response from ListSubscriptions.
http://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-wordpress-installations.73591/
The enable-auto-updates operation switches on auto-updates on a WordPress installation.
The disable-auto-updates operation switches off auto-updates on a WordPress installation.
The remove command uninstalls WordPress from a site.
The update-core command updates a WordPress installation.
The clear-cache command checks whether updates are available for the selected WordPress installation.
The activate-plugin command activates the specified plugin on the specified WordPress installation.
The deactivate-plugin command deactivates the specified plugin on the specified WordPress installation.
The uninstall-plugin command removes the specified plugin from the specified WordPress installation.
The update-plugin command updates the specified plugin on the specified WordPress installation.
The install-plugin command installs the specified plugin on the specified WordPress installation.
The activate-theme command activates the specified theme on the specified WordPress installation.
The uninstall-theme command removes the specified theme from the specified WordPress installation.
The update-theme command updates the specified theme on the specified WordPress installation.
The install-theme command installs the specified theme on the specified WordPress installation.
The get-list command retrieves the list of all WordPress installations on a server.
The get-plugin-list command retrieves the list of plugins installed on a WordPress installation.
The get-theme-list command retrieves the list of themes installed on a WordPress installation.
The search-plugins command searches for installed plugins by a plugin name.
The search-themes command searches for installed themes by a theme name.
The get-security-status operation retrieves the security status of the specified WordPress installation.
using key crt and CA text to install certificate to webspace
Error: Parser error: Request is invalid. Error in line 2: Element 'webspace': This element is not expected. Expected is one of ( server, client, domain, subdomain, dns, db_server, mail, migration, certificate, domain_alias )
Plesk Version 12.0.18
any help much appreciated
Hello,
I am trying to get the id of a just created subscription in order to use in the creation of a database. However I can't get the id and in var_dumb($info) it returns false. Here is my code:
`
$paramsPleskSubscription = array(
'domain_name'=>$company.'.example.com',
'username'=>$email,
'password'=>$password,
'ip_address'=>'99.99.99.99',
'owner_id'=>$clientPleskId,
'service_plan_id'=>$service_plan_id,
);
$requestSub = new \pmill\Plesk\CreateSubscription($config, $paramsPleskSubscription);
$info2 = $requestSub->process();
var_dump($info2);
$subscriptionId=$requestSub->id;
echo "subscription:".$subscriptionId;` //it returns nothing
Any ideas? Thank you in advance
Hello, i would like to know if this API works with Plesk Onyx ?
I can't run any exemples... HTTP ERROR 500
I'm creating a email and I get this error because I use very strong random generated password that uses all kind of chars.
DOMDocument::loadXML(): xmlParseEntityRef: no name in Entity, line: 13
I guess it could be because of some symbols like & < > that break the xml syntax.
By the way thanks very much for this library! :)
Hello
im trying to delete multipe alias domains in the same array but it only deletes the last.
here is my code:
<?php
require_once("config.php");
$params = array(
'alias'=>'test123.ch',
'alias'=>'test456.ch'
);
$request = new \pmill\Plesk\DeleteSiteAlias($config, $params);
$info = $request->process();
var_dump($info);
?>
my final target is to delete some alias domains from the autodelete date,
my sqlcode:
$sql = "SELECT id, domain, autodel FROM alias WHERE autodel < NOW()";
$result = mysql_query($sql);
while($row=mysql_fetch_array ( $result , MYSQL_ASSOC ) )
{
foreach( $row as $key => $field )
{
}
echo $row['domain'];
}
That outputs me the domains that have to be delete from plesk&database.
Can somebody give me a hint ?
Greetings and Thanks
While or after creating an email address it would be nice to set:
Email forwarding/autoresponder/aliases
http://docs.plesk.com/en-US/12.5/api-rpc/reference/managing-mail/mail-account-settings.34481/
When i am creating email addresses using the api provided as Create/Delete email addresses although email accounts are getting added but accounts added using php code via this php-plesk repository are not authenticated..
My version of plesk is 12.0 when i am creating email accounts using api from php- plesk repository i am not able to login using the email id and password i used for email creation.
I am not able to figure out what may be the reason for it..
Is there any method to get a complete list of all domains on the server?
I can get a list of all subscriptions but some have multiple domains so I cannot get a complete list of all domains. Currently trying to get a list of all domains so I can then get a list of all email accounts for each domain name.
It would be awesome if you could implement the creation and deletion of databases.
Is this possible? ๐
You have to check the status of each subscription before calling the children() method on each iteration. Subscription with status error gives a fatal error of the PHP script since it does not have any children...
`protected function processResponse($xml)
{
$result = [];
for ($i = 0; $i < count($xml->webspace->get->result); $i++) {
$webspace = $xml->webspace->get->result[$i];
if ( $webspace->status != "ok" )
continue;
foreach ($webspace->data->hosting->children() as $host) {
$hosting[$host->getName()] = Xml::getProperties($host);
}
$subscriptions = [];
foreach ($webspace->data->subscriptions->children() as $subscription) {
$subscriptions[] = [
'locked' => (bool)$subscription->locked,
'synchronized' => (bool)$subscription->synchronized,
'plan-guid' => (string)$subscription->plan->{"plan-guid"},
];
}
$result[] = [
'id' => (string)$webspace->id,
'status' => (string)$webspace->status,
'subscription_status' => (int)$webspace->data->gen_info->status,
'created' => (string)$webspace->data->gen_info->cr_date,
'name' => (string)$webspace->data->gen_info->name,
'owner_id' => (string)$webspace->data->gen_info->{"owner-id"},
'hosting' => $hosting,
'real_size' => (int)$webspace->data->gen_info->real_size,
'dns_ip_address' => (string)$webspace->data->gen_info->dns_ip_address,
'htype' => (string)$webspace->data->gen_info->htype,
'subscriptions' => $subscriptions,
];
}
return $result;
}`
So I just put a simple check:
if ( $webspace->status != "ok" ) continue;
And it is OK.
Thanks for committing this.
When i was trying the examples/list_subscriptions.php, i get this error and no subscriptions are displayed.
PHP Fatal error: Call to undefined function pmill\Plesk\curl_init() in /var/www/html/src/pmill/Plesk/BaseRequest.php
Related to #15
It gives error on rename subdomain, actually I was able to fix
in constructor of RenameSubdomain
Replace
$this->params['id'] = $info['id'];
with
$this->default_params['id'] = $info['id'];
$this->default_params['name'] = $info['name'];
I get this error by trying to test the example from php-plesk: ListEmailAddresses
Fatal error: Uncaught pmill\Plesk\ApiRequestException: Error: Incorrect request parameters submitted in C:\wamp64\www\src\pmill\Plesk\BaseRequest.php:87 Stack trace: #0 C:\wamp64\www\src\pmill\Plesk\ListEmailAddresses.php(44): pmill\Plesk\BaseRequest->__construct(Array, Array) #1 C:\wamp64\www\config.php(37): pmill\Plesk\ListEmailAddresses->__construct(Array, Array) #2 {main} thrown in C:\wamp64\www\src\pmill\Plesk\BaseRequest.php on line 87
here is the code:
$config = array(
'host'=>'MYDOMAIN.DOM',
'username'=>'USER',
'password'=>'PASSWORD',
);
$params = array(
'domain'=>'mydomain.dom',
);
$request = new \pmill\Plesk\ListEmailAddresses($config, $params);
$info = $request->process();
var_dump($info);
can any help me?
Plesk version is: 17.5.3
When a subscription with hosting type "website" is created it returns false or the script keeps running until it throws an error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.