• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question php script to create websites

thomasvestergaard

New Pleskian
Hello

I use plesks 10.4.4 and would like to know if i can create websites with a php script?

Today i create them manually but the amount of sites i create is getting more and more and would like to automate the process.

I know nothing of plesks api so any help is appreciated

Regards
Thomas
 
My problem is that i don't know how to call "create website" and how to set all of the parametres that is avaliable. I'm looking for a easy to follow guide in php?
 
I now have access to get all domains and see som info.

1. But in this add excample how do i know what to set in webspace-id, can i leave it blank and it will autocreate a unik id?
2. How do i enable "Microsoft ASP support "
3. How do i enable "Custom error documents "
4. How do i enable " Additional write/modify permissions "
5. How do i switch Web statistics to "Webalizer" and check the checkbox in "accessible via password-protected directory '/plesk-stat/webstat/"

<packet version="1.6.3.0">
<site>
<add>
<gen_setup>
<name>sample.com</name>
<webspace-id>13</webspace-id>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>fastcgi</name>
<value>true</value>
</property>
<property>
<name>php</name>
<value>true</value>
</property>
</vrt_hst>
</hosting>
</add>
</site>
</packet>
 
I now have this php code, but have no idear how to move on

function addNewSite()
{
$xmldoc = new DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;

// <packet>
$packet = $xmldoc->createElement('packet');
$packet->setAttribute('version', '1.6.3.0');
$xmldoc->appendChild($packet);

// <packet/site>
$site = $xmldoc->createElement('site');
$packet->appendChild($site);

// <packet/domain/add>
$add = $xmldoc->createElement('add');
$domain->appendChild($add);

// <packet/domain/get/gen_setup>
$gen_setupTmp = $xmldoc->createElement('gen_setup');
$get->appendChild($gen_setupTmp);

// dataset elements
$gen_setupTmp->appendChild($xmldoc->createElement('name'));
$gen_setupTmp->appendChild($xmldoc->createElement('webspace-id'));



return $xmldoc;
}
 
And what about these,

  • webspace-name, required
    It defines the name of a subscription to which the Panel will assign a new site. Data type: string.

  • webspace-id, required
    It defines the ID of a subscription to which the Panel will assign a new site. Data type: string.

  • webspace-guid, required
    It defines the GUID of a subscription to which the Panel will assign a new site. Data type: string
 
Sorry, I'm not PHP developer. I have given you all available documentation and direction. Then you, as a PHP developer, can sort it out by yourself, I think.
 
Back
Top