<?php require_once "../config.php"; /* * Lists all sites, or if subscription_id is supplied lists only that subscriptions sites */ $params = array('subscription_id' => 0); $request = new \pmill\Plesk\ListSites($config, $params); $info = $request->process(); var_dump($info);
} echo "Subscription found: " . $data['subscription_id'] . "<BR>"; if ($runSiteTests) { /* * 9. Create new site (CreateSite) */ $data['domain'] = random_string() . '.com'; $request = new \pmill\Plesk\CreateSite($config, array('domain' => $data['domain'], 'subscription_id' => $data['subscription_id'])); $info = $request->process(); $data['site_id'] = $request->id; echo "Site created: " . $data['domain'] . "<BR>"; /* * 10. Find created site (ListSite) */ $request = new \pmill\Plesk\ListSites($config, array('subscription_id' => $data['subscription_id'])); $sites = $request->process(); $site_found = FALSE; foreach ($sites as $site) { if ($site['id'] == $data['site_id']) { $site_found = TRUE; } } if (!$site_found) { throw new Exception("Couldn't find created site"); } echo "Site found: " . $data['domain'] . "<BR>"; /* * 11. Update site information (UpdateSite) */ $data['domain'] = random_string() . '.com'; $request = new \pmill\Plesk\UpdateSite($config, array('id' => $data['site_id'], 'domain' => $data['domain']));