Account registration via PHP

Hi, I have a problem. I’m looking for a script where users could create an account using a PHP form. Does anyone have it? I need it.

Thanks for the script and for the advice.

The rest api documentation already contains usable examples: Rest Api — Hestia Control Panel documentation

Thank you very much.

How about developing a WordPress plugin integrated with Hestia? I would be willing to pay for that.

For controlling everything with in Wordpress. Even if somebody is willing to spend 10k / 20k euro/dollar on it. I am not availble… doesn’t make sense to do it you will always run behind of the main panel…

For creating an Hestia account use Blesta / WHCMS / What ever and tied it in an administration panel…

For free “hosting” accounts it will not be difficult and could be done with in 20 minutes…

How about an extension for WooCommerce? Only for hosting plans. No domain registrations.

It shouldn’t be difficult at least for the ordering part.

I don’t have an idea how yet but as long there is an event/hook available that runs on “order_complete” or something like that it should be possible to create an account on a server…

If intrested send me a DM / email / Contact me at Discord…

I’m trying to understand api, but I’m a beginner when it comes to api. So I’m wondering if anyone could make me a registration form.

https://docs.hestiacp.com/admin_docs/api/rest_api.html#create-user-account

Yes, I know, but I don’t know how to combine html from php.

I dont think anyone is willing to do it for free, if you want to pay it - it’s possible someone might step in.

All I need is form and I will solve everything myself. I can do the form myself, but I don’t know how to combine html code from PHP, because I’m not very good in api.

I don’t have any code where a user is created yet…

<?php

// Server credentials
// Should be hardcoded 
$hst_hostname = 'server.hestiacp.com';
$hst_port = '8083';
$hst_username = 'admin';
$hst_password = 'p4ssw0rd';
$hst_returncode = 'yes';
$hst_command = 'v-add-user';

// New Account
$username = 'demo';
$password = 'd3m0p4ssw0rd';
$email = '[email protected]';
$package = 'default';
$first_name = 'Rust';
$last_name = 'Cohle';

// Prepare POST query / Should be come from the html / post request 
$postvars = array(
    'user' => $hst_username,
    'password' => $hst_password,
    'returncode' => $hst_returncode,
    'cmd' => $hst_command,
    'arg1' => $username,
    'arg2' => $password,
    'arg3' => $email,
    'arg4' => $package,
    'arg5' => $first_name,
    'arg6' => $last_name
);
//Connecting with Hestia API 
// Send POST query via cURL
$postdata = http_build_query($postvars);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $hst_hostname . ':' . $hst_port . '/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);

// Check result
if($answer === 0) {
    echo "User account has been successfuly created\n";
} else {
    echo "Query returned error code: " .$answer. "\n";
}
2 Likes

sorry about my speake english , I’am not developer, just fan;

Where i di it was find a template that satisfy my spectative (including a page with form), download an modify and add the example recommend in the documentation of HestiaCP and it has worked good for me very well…

O hope this help you…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.