Jump to content
[MUST READ] Forum Rules ×

MyOwnFreeHost API Client


Recommended Posts

10 hours ago, Angel said:

@einet

I have an idea. You & I could make some documentation for the API Client Area you made (to make it easier for others to get started), and we could put up a GitHub repository for it so people can open issues and we can make it better.

I believe documentation already exist for what einet sent you.

Link to comment
Share on other sites

On 15/12/2017 at 9:06 PM, Angel said:

Puse el nombre de usuario y la contraseña de la API y lo cargué en mi sitio, Chrome devuelve un error de 500, ¿estoy haciendo algo mal?

remember to use a PHP version 5.3 or higher in your test hosting to avoid code errors
 

Link to comment
Share on other sites

15 hours ago, mike said:

I believe documentation already exist for what einet sent you.

@mike is right there is already a project created in GitHub only that the one that exists there does not include the complete script (composer) and its libraries and I would like to participate in such a project but I do not have free time

Link to comment
Share on other sites

14 hours ago, PlanetCloud said:

Hi,

I've created the Client Area simmiliar to InfinityFree but a bit Noober because Im new with this but I don't know how to use the API Provided because I am not very experienced with PHP.

All I need was someone to guide me to make the cPanel and Login stuff working because now It's just a templete.
Also I need the API to be able to retrive user account.

And @InfinityFree is the user account information was stored on iFastNet/Byte or on your own server?

 

Thanks for your reply in advance

The API doesn't really allow you to search or get information about accounts, so storing the account details in your own database is the only option IMO. There is no way to "retrieve" an account through the API, so you should probably store at least your own 8 character username and the host_12345678 username.

Link to comment
Share on other sites

1 hour ago, PlanetCloud said:

Hi, I keep getting this error : Parse error: syntax error, unexpected '-', expecting ',' or ';' in C:\wamp64\www\other-project\mofh-api\index.php on line 5

Can somebody help me out?
 

My code :


<?php

require_once(vendor\autoload.php);

use vendor\hansadema\mofh-client\src\Client.php;

// 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();
}

?>

try to use the one that I just sent to the email remember to read the instructions and that the php version of your localhost is 5.4 or higher

Link to comment
Share on other sites

3 minutes ago, PlanetCloud said:

Hi, I've tested your code and it gave me this error :

t4U2Y3.PNG

oquei you placed your username and password of your client reseller in
$ client = new \ HansAdema \ MofhClient \ Client ('API Username', 'API Password');
and you added the ip of the team where you are executing the script inside the folder there are some images and a txt with instructions

Link to comment
Share on other sites

10 minutes ago, Hostingaj said:

Thanks, got the email.

 

16 minutes ago, einet said:

oquei you placed your username and password of your client reseller in
$ client = new \ HansAdema \ MofhClient \ Client ('API Username', 'API Password');
and you added the ip of the team where you are executing the script inside the folder there are some images and a txt with instructions

E0e3YfQsSmGWfKf8J5i8xw.jpg

Local test with the script working. In this case, testing if the google.com domain exists in my reseller server.
Showing 1 indicates that the domain is available in my reseller server logically is to verify if a domain or sub domain of your reseller hosting exists or not a basic example. If you were able to perform this test without any error, indicate that the usename and password are well added remember to add the ip from where you are doing tests

Link to comment
Share on other sites

2 minutes ago, PlanetCloud said:

I added my API and Password also my IP.

When I put it on my website, it shows ERROR 500
https://api.planetcloudhosting.cf/mofh complete/mofh/?i=2

 

Why not?
We could chat thru Email or WhatsApp if you wanted to

update the php version from your hosting cpanel where you test a version higher than 5.4 eh sent another message to the indicated mail

Link to comment
Share on other sites

1 minute ago, PlanetCloud said:

PHP 7.0 still the same.

How to check my server IP?

 

Is it correct to Google "What Is My IP" for my computer?
And is it correct to use Google Dig Tool to search "www.planetcloudhosting.cf" IP?

if you are going to carry out local tests from your pc, you must indicate the ip of your computer, the one indicated by https://www.cualesmiip.com/ if you are going to execute the script from your web server, you must indicate the ip of your web server in the api reseller

Link to comment
Share on other sites

10 minutes ago, einet said:

if you are going to carry out local tests from your pc, you must indicate the ip of your computer, the one indicated by https://www.cualesmiip.com/ if you are going to execute the script from your web server, you must indicate the ip of your web server in the api reseller

can also activate the error log in alter php config to see with more details the errors shown by the php when the ip is incorrectly configured shows the address from where the script is running on your hosting

Link to comment
Share on other sites

14 hours ago, PlanetCloud said:

<?php
include 'vendor/autoload.php';
// In [API username and API password] go the data of your reseller account that the data gives you here https://panel.myownfreehost.net/panel/index2.php?option=api

$client = new \HansAdema\MofhClient\Client('ZbzVk5V3JxXnFK50tmB8reIBSSCir9UrdMwi', 'SFZb6XH4VW2Ii9SyIKQFq0bi0');
//example 1 domain exist?
$domain = $_GET['domain'];

// We check if the sub-domain is available
echo $client->availability($domain);

//  Create a user account ('User8charactersmax', 'password','email','Domainorsub-domain','planName')
//echo $client->createAccount('username8charmax', 'password', 'email', 'domainexample.com', 'plan_one');

// Suspend user account must be the same as example registry name ('username8charmax', 'Suspension message')
//echo $client->suspend('username8charmax', 'Towards a test with a script in php');

// Change account password example('username8charmax', 'newpassword')
//echo $client->password('username8charmax', '123456as');

// Reactivate account suspended Need only the example user name (username8charmax)
//echo $client->unsuspend('username8charmax');

// One example live in create account
//echo $client->createAccount('x3bugger', '123456asxl', '[email protected]', 'x3bugger.domain.com', 'standar');

That is my code (Of course I changed the Password and Username!.

Do I need to modify anything??

if you have placed the user and password of your reseller api mas IP in the panel of the api reseller does not need to do anything else can perform tests with functions that are disabled with //

for example:
// echo $ client-> availability ($ domain);
// echo $ client-> createAccount ('');
// echo $ client-> suspend ('');
// echo $ client-> password ('');
// echo $ client-> unsuspend ('');
// echo $ client-> createAccount ('');
are the only ones you can use with the script uncheck the line you want to use since it is currently active is echo $ client-> availability ($ domain); to verify if a domain name exists in your reseller

Link to comment
Share on other sites

17 hours ago, PlanetCloud said:

De acuerdo, ¿cómo agregar el parámetro sobre qué dominio verificar?

to verify a domain you can do it from a search form or by POST or GET method in the example that I add to verify the domain was by get in the url when ending like this? domaim = the examplenameofexample.com and in this case use the function $ client-> availability ($ domain); showing answer of 1 if the domain is available and 0 or nothing if it is already registered I will make a simpler example to make it easier

Link to comment
Share on other sites

QUyxqx1.png

https://i.imgur.com/QUyxqx1.png

Here I leave a clearer example to verify a domain with a form and the function plus the working library I remind you that the file should go next to the index since it requires the library that you spent last remember to add the user and pass of your reseller panel to the file that happened to them

I apologize if I wrote with spelling errors and if my English is not understood ice a quick example

THE FILE >> CHECK DOMAIN FILE

Link to comment
Share on other sites

  • 3 weeks 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...