Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <? Php
  2.  
  3. // Credenciales del servidor
  4. $ Vst_hostname = 'server.vestacp.com';
  5. $ Vst_username = 'admin';
  6. $ Vst_password = 'p4ssw0rd';
  7. $ Vst_returncode = 'sí';
  8. $ Vst_command = 'v-add-user';
  9.  
  10. // Nueva cuenta
  11. $ Username = 'demo';
  12. $ Password = 'd3m0p4ssw0rd';
  13. $ Email = 'demo@gmail.com';
  14. $ Package = 'default';
  15. $ Fist_name = 'Rust';
  16. $ Last_name = 'Cohle';
  17.  
  18. // Preparar la consulta POST
  19. $ Postvars = array (
  20.     'User' => $ vst_username,
  21.     'Contraseña' => $ vst_password,
  22.     'Código de retorno' => $ vst_returncode,
  23.     'Cmd' => $ vst_command,
  24.     'Arg1' => $ nombre de usuario,
  25.     'Arg2' => $ contraseña,
  26.     'Arg3' => $ correo electrónico,
  27.     'Arg4' => $ paquete,
  28.     'Arg5' => $ fist_name,
  29.     'Arg6' => $ last_name
  30. );
  31. $ Postdata = http_build_query ($ postvars);
  32.  
  33. // Enviar consulta POST a través de cURL
  34. $ Postdata = http_build_query ($ postvars);
  35. $ Curl = curl_init ();
  36. Curl_setopt ($ curl, CURLOPT_URL, 'https: //'. $ Vst_hostname. ': 8083 / api /');
  37. Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, true);
  38. Curl_setopt ($ curl, CURLOPT_SSL_VERIFYPEER, false);
  39. Curl_setopt ($ curl, CURLOPT_SSL_VERIFYHOST, false);
  40. Curl_setopt ($ curl, CURLOPT_POST, true);
  41. Curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ postdata);
  42. $ Answer = curl_exec ($ curl);
  43.  
  44. // Comprobar resultado
  45. If ($ answer == 0) {
  46.     Echo "La cuenta de usuario ha sido creada correctamente \ n";
  47. } Else {
  48.     Echo "Query devolvió el código de error:". $ Answer. "\norte";
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement