Jump to content
[MUST READ] Forum Rules ×

What exactly does the API send to the callback URL?


Ulti

Recommended Posts

Hello, I am working on a panel using the MOFH API, I want to sync suspended accounts between both sides using the callback URL, however, I can't find any documentation on what the callback URL sends, and how to read it. Does anyone know what it sends, and what have you done to read it?

Link to comment
Share on other sites

First of all, I don't answer PMs like that. I'm happy to engage in public discussion, but I don't give personal support in coding.

Whenever an account status changes, that URL is called with three post variables: 'username', 'status' and 'comments'. The username is the FTP username (like host_123456789), the status can be ACTIVATE, DELETE, SUSPENDED or REACTIVATE and the comments contain additional information. You can use that information to keep the known account status updated.

Link to comment
Share on other sites

  • 1 month later...
On 7/10/2017 at 7:53 AM, InfinityFree said:

First of all, I don't answer PMs like that. I'm happy to engage in public discussion, but I don't give personal support in coding.

Whenever an account status changes, that URL is called with three post variables: 'username', 'status' and 'comments'. The username is the FTP username (like host_123456789), the status can be ACTIVATE, DELETE, SUSPENDED or REACTIVATE and the comments contain additional information. You can use that information to keep the known account status updated.

What would the best way to see the comments? Something like a var_dump() but it would need to be stored so you could go in and see the result. 

Link to comment
Share on other sites

On 8/11/2017 at 6:21 PM, Dog2puppy said:

What would the best way to see the comments? Something like a var_dump() but it would need to be stored so you could go in and see the result. 

On InfinityFree.net, I store the full comment when it arrives and I extract data from it to determine what kind of suspension it is at runtime. That logic is probably one of the most changed things in my system, so keeping the raw data is highly recommended.

Link to comment
Share on other sites

6 hours ago, InfinityFree said:

On InfinityFree.net, I store the full comment when it arrives and I extract data from it to determine what kind of suspension it is at runtime. That logic is probably one of the most changed things in my system, so keeping the raw data is highly recommended.

Okay. I think taking the comments and doing var_dump on it and sorting the result in MySQL for later viewing is best. 

Link to comment
Share on other sites

  • 1 month later...


I do not know where you add these codes, whmcs is an external script

Example

use \HansAdema\MofhClient\Client;

// Create a new API client with your API credentials.
$client = Client::create([
    'apiUsername' => 'your_api_username',
    'apiPassword' => 'your_api_password',
    'plan' => 'my_plan', // 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' => 'abcdefgh', // A unique, 8 character identifier of the account.
    'password' => 'password123', // A password to login to the control panel, FTP and databases.
    'domain' => 'userdomain.example.com', // Can be a subdomain or a custom domain.
    'email' => '[email protected]', // The email address of the user.
    'plan' => 'my_plan', // Optional, you can submit a hosting plan here or with the Client instantiation.
]);

// Send the API request and keep the response.
$response = $request->send();

// Check whether the request was successful.
if ($response->isSuccessful()) {
   echo 'You can login as: ' . $response->getVpUsername();
} else {
   echo 'Failed to create account: ' . $response->getMessage();
}
Link to comment
Share on other sites

12 minutes ago, selamhosting said:


I do not know where you add these codes, whmcs is an external script

Example


use \HansAdema\MofhClient\Client;

// Create a new API client with your API credentials.
$client = Client::create([
    'apiUsername' => 'your_api_username',
    'apiPassword' => 'your_api_password',
    'plan' => 'my_plan', // 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' => 'abcdefgh', // A unique, 8 character identifier of the account.
    'password' => 'password123', // A password to login to the control panel, FTP and databases.
    'domain' => 'userdomain.example.com', // Can be a subdomain or a custom domain.
    'email' => '[email protected]', // The email address of the user.
    'plan' => 'my_plan', // Optional, you can submit a hosting plan here or with the Client instantiation.
]);

// Send the API request and keep the response.
$response = $request->send();

// Check whether the request was successful.
if ($response->isSuccessful()) {
   echo 'You can login as: ' . $response->getVpUsername();
} else {
   echo 'Failed to create account: ' . $response->getMessage();
}

This just seems to be the scrypt that sits between the signup form and the server. Basically, you create a form and use this script to send details to byet servers.

Im Not 100% sure if this is the only thing it does, as I haven't checked the entire source code of Hans scrypt.

Link to comment
Share on other sites

23 hours ago, selamhosting said:

image 1 https://prntscr.com/glgn4b

image 2 https://prntscr.com/glgngm

 

how to integrate yada how to put files in the picture

The script should be installed with Composer. Downloading the script as a ZIP file and trying to integrate the files directly in your app is hard, if not impossible.

If you don't know about Composer, I highly recommend to learn it.

Link to comment
Share on other sites

On 9/16/2017 at 6:38 AM, InfinityFree said:

The script should be installed with Composer. Downloading the script as a ZIP file and trying to integrate the files directly in your app is hard, if not impossible.

If you don't know about Composer, I highly recommend to learn it.

MyOwnFreeHost doesn't support Composer. 

Link to comment
Share on other sites

On 9/18/2017 at 2:12 AM, Dog2puppy said:

MyOwnFreeHost doesn't support Composer. 

Depends on what you mean by "support".

If you mean "you can execute Composer commands on the hosting server", then no. But you can install the dependencies on your own computer and upload them to a free hosting account and they will work perfectly.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...