Advertisement
Guest User

Untitled

a guest
Oct 7th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. <?php
  2. function generateRandomString($length = 8) {
  3. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  4. $charactersLength = strlen($characters);
  5. $randomString = '';
  6. for ($i = 0; $i < $length; $i++) {
  7. $randomString .= $characters[rand(0, $charactersLength - 1)];
  8. }
  9. return $randomString;
  10. }
  11. $username = generateRandomString();
  12. $password = $_GET['password'];
  13. $domain = $_GET['domain'];
  14. $email = $_GET['email'];
  15. require 'vendor/autoload.php';
  16. use \HansAdema\MofhClient\Client;
  17. // Create a new API client with your API credentials.
  18. $client = Client::create([
  19. 'apiUsername' => 'XYNzp9wIVGJjc6emkjZSJTLlf4OJf0r389NDCKtwPua67Eyvf8BEBUW1Dc8ZvIXCKAVmSXvSZaRaLuOsUfIa4e5lM44FrIGAUPq7LUGmaQAmN8XaxNQiOlCCDP5csf1qo4lXqLoZCKcfRl8Wy10ZyTZrYrP3x8bONKoZ4bMRDXLMyq8jApPI3hm23vFbSOkCVO2T3NEt2fURgBkI8T55Q09YayOusf9Ogop2iPVgtn7bLxHpC0O2DvU2TESOEId',
  20. 'apiPassword' => 'shE3LX4bimJbUpPTHUsB5701J0mX7YbWPSdPAceR4qE1aNuYaqPTtl6QxHnu7x95JFOjDoHS5bonRfe5uvHIVCYCTojsSmpcgvqkDVAgL3UmLljzqNstz1TpWH12GSnd0rBpEqaeBjBfSOtzU9oys0e77ac1hY9Ju77ZQ6EEOdlWMMvqoiVjfK7INKj4URg8Njay5CT8IxTvx3Veg7m0JPJhlGlIhQI9VVI038Yd4aE5ZdT70ySzpY1C15hUsLl',
  21. 'plan' => 'free', // Optional, you can define it here or define it with the createAccount call.
  22. ]);
  23. // Create a request object to create the request.
  24. $request = $client->createAccount([
  25. 'username' => "$username", // A unique, 8 character identifier of the account.
  26. 'password' => "$password", // A password to login to the control panel, FTP and databases.
  27. 'domain' => "$domain", // Can be a subdomain or a custom domain.
  28. 'email' => "$email", // The email address of the user.
  29. ]);
  30. // Send the API request and keep the response.
  31. $response = $request->send();
  32. // Check whether the request was successful.
  33. if ($response->isSuccessful()) {
  34. $cp_user=$response->getVpUsername();
  35. echo "{\"cp_user\":\"$cp_user\",\"sql_host\":\"null\",\"status\":\"success\"}";
  36. } else {
  37. $error=$response->getMessage();
  38. echo "{\"status\":\"error\",\"message\":\"$error\"}";
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement