public function view()
 {
     $config = array('host' => Config::get('plesk.url'), 'username' => \Config::get('plesk.username'), 'password' => \Config::get('plesk.password'));
     $params = array('id' => 2);
     $request = new \pmill\Plesk\GetClient($config, $params);
     $info = $request->process();
     var_dump($info);
 }
Пример #2
0
if (!isset($data['unlimited_plan_id'])) {
    throw new Exception("Couldn't find unlimited service plan");
}
/*
 * 4. Creates a new client (CreateClient)
 */
$data['client_username'] = strtolower(random_string());
$request = new \pmill\Plesk\CreateClient($config, array('contact_name' => random_string(), 'username' => $data['client_username'], 'password' => random_string(16) . "1!"));
$request->process();
$data['client_id'] = $request->id;
echo "Client created: " . $data['client_username'] . "<BR>";
try {
    /*
     * 5. Get new client from server (GetClient)
     */
    $request = new \pmill\Plesk\GetClient($config, array('username' => $data['client_username']));
    $info = $request->process();
    echo "Client found: " . $data['client_username'] . "<BR>";
    /*
     * 6. Update client information (UpdateClient)
     */
    $request = new \pmill\Plesk\UpdateClient($config, array('username' => $data['client_username'], 'phone' => random_string(), 'email' => random_string() . '@example.com'));
    $info = $request->process();
    echo "Client updated: " . $data['client_username'] . "<BR>";
    /*
     * 7.  Create subscription (CreateSubscription)
     */
    $params = array('domain_name' => random_string() . '.com', 'username' => $data['client_username'], 'password' => random_string(16) . '1!', 'ip_address' => $data['shared_ip_address'], 'owner_id' => $data['client_id'], 'service_plan_id' => $data['unlimited_plan_id']);
    $request = new \pmill\Plesk\CreateSubscription($config, $params);
    $request->process();
    $data['subscription_id'] = $request->id;