Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function generateRandomString($length = 8) {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, $charactersLength - 1)];
- }
- return $randomString;
- }
- $username = generateRandomString();
- $password = $_GET['password'];
- $domain = $_GET['domain'];
- $email = $_GET['email'];
- require 'vendor/autoload.php';
- use \HansAdema\MofhClient\Client;
- // Create a new API client with your API credentials.
- $client = Client::create([
- 'apiUsername' => 'XYNzp9wIVGJjc6emkjZSJTLlf4OJf0r389NDCKtwPua67Eyvf8BEBUW1Dc8ZvIXCKAVmSXvSZaRaLuOsUfIa4e5lM44FrIGAUPq7LUGmaQAmN8XaxNQiOlCCDP5csf1qo4lXqLoZCKcfRl8Wy10ZyTZrYrP3x8bONKoZ4bMRDXLMyq8jApPI3hm23vFbSOkCVO2T3NEt2fURgBkI8T55Q09YayOusf9Ogop2iPVgtn7bLxHpC0O2DvU2TESOEId',
- 'apiPassword' => 'shE3LX4bimJbUpPTHUsB5701J0mX7YbWPSdPAceR4qE1aNuYaqPTtl6QxHnu7x95JFOjDoHS5bonRfe5uvHIVCYCTojsSmpcgvqkDVAgL3UmLljzqNstz1TpWH12GSnd0rBpEqaeBjBfSOtzU9oys0e77ac1hY9Ju77ZQ6EEOdlWMMvqoiVjfK7INKj4URg8Njay5CT8IxTvx3Veg7m0JPJhlGlIhQI9VVI038Yd4aE5ZdT70ySzpY1C15hUsLl',
- 'plan' => 'free', // Optional, you can define it here or define it with the createAccount call.
- ]);
- // Create a request object to create the request.
- $request = $client->createAccount([
- 'username' => "$username", // A unique, 8 character identifier of the account.
- 'password' => "$password", // A password to login to the control panel, FTP and databases.
- 'domain' => "$domain", // Can be a subdomain or a custom domain.
- 'email' => "$email", // The email address of the user.
- ]);
- // Send the API request and keep the response.
- $response = $request->send();
- // Check whether the request was successful.
- if ($response->isSuccessful()) {
- $cp_user=$response->getVpUsername();
- echo "{\"cp_user\":\"$cp_user\",\"sql_host\":\"null\",\"status\":\"success\"}";
- } else {
- $error=$response->getMessage();
- echo "{\"status\":\"error\",\"message\":\"$error\"}";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement