1. Go to this page and download the library: Download hansadema/mofh-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hansadema / mofh-client example snippets
use \InfinityFree\MofhClient\Client;
// Create a new API client with your API credentials.
$client = new Client("<MOFH API username>", "<MOFH API password>");
// Create a new hosting account.
$createResponse = $client->createAccount(
'abcd1234', // A unique, 8 character identifier of the account. Primarily used as internal identifier.
'password123', // A password to login to the control panel, FTP and databases.
'[email protected]', // The email address of the user.
'userdomain.example.com', // Initial domain of the account. Can be a subdomain or a custom domain.
'my_plan', // The hosting plan name at MyOwnFreeHost.
);
// Check whether the request was successful.
if ($createResponse->isSuccessful()) {
echo "Created account with username: ".$createResponse->getVpUsername();
} else {
echo 'Failed to create account: ' . $createResponse->getMessage();
die();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.