Hi all,
I would need some help on initiating a call to cPanel API from a remote server.
I’ll need to access the API for getting a listing and modifying subdomains and reading and modifying a file on the hosting.
Currently I have some problem on how to create the actual API call in PHP, this is what I have so far :
Hi all,
I would need some help on initiating a call to cPanel API from a remote server.
I’ll need to access the API for getting a listing and modifying subdomains and reading and modifying a file on the hosting.
Currently I have some problem on how to create the actual API call in PHP, this is what I have so far :
Currently, I don’t understand with what I should change the “cpsess###########” with!
Secondly, I’m not even sure I’m using the right authentication method!
And Finally, I see that is I need to modify the content of one file, this need to be done with UAPI, but can I access UAPI from a remote server?
Thank you!
I would need some help on initiating a call to cPanel API from a remote server.
I’ll need to access the API for getting a listing and modifying subdomains and reading and modifying a file on the hosting.
Currently I have some problem on how to create the actual API call in PHP, this is what I have so far :
Hi all,
I would need some help on initiating a call to cPanel API from a remote server.
I’ll need to access the API for getting a listing and modifying subdomains and reading and modifying a file on the hosting.
Currently I have some problem on how to create the actual API call in PHP, this is what I have so far :
Code:
$user = "user";
$pass = "password";
// The URL
$url = 'https://'.$user.':'.$pass'@mycpanel.com:2083/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SubDomain&cpanel_jsonapi_func=listsubdomains®ex=domain';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $time);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// Get response from the server.
$resp = curl_exec($ch);
// Unserialize data
$res = unserialize($resp);
Secondly, I’m not even sure I’m using the right authentication method!
And Finally, I see that is I need to modify the content of one file, this need to be done with UAPI, but can I access UAPI from a remote server?
Thank you!