Get host information UAPI
-
Hey there! I'm not good with PHP, so I can't comment on the code itself, but those older API calls have been deprecated for some time. Can you try manually running the API calls to see if you get the same error? 0 -
I think you are doing the authentication incorrectly. The new/current way for connecting to the API is to use Manage API Tokens: and for WHM/root level you want Development->Manage API tokens. If you want to prompt for the username and password, you can then call Basic authentication headers. You then make calls using the user's username and the API Token as the password - see 0 -
rbairwell Do you have some messanger or somethink else? It doesn't work...(( require_once "/usr/local/cpanel/php/cpanel.php"; $cPusername = $details['service'>['username'>; $cPpassword = $details['service'>['password'>; $cPhost = $details['server'>['host'>; $cPdomain = $details['service'>['domain'>; $categoryId = $details['product'>['category_id'>; // Print the header header('Content-Type: text/plain'); // Connect to cPanel - only do this once. $cpanel = new CPANEL(); // Call the API $response = $cpanel->uapi( 'Tokens', 'create_full_access', array ( 'name' => $cPusername, ) ); $data = " ".print_r($cpanel, true)."
"; file_put_contents('cPanel_filename.txt', $data);0 -
Hi, That code example is a mangled version of the "LiveAPI PHP" code from the UAPI API call with the username username
and the API TokenU7HMR63FHY282DQZ4H5BIH16JLYSO01M
for hostexample.com
, you'll get the command line request:curl -H'Authorization: cpanel username:U7HMR63FHY282DQZ4H5BIH16JLYSO01M' 'https://example.com:2083/execute/Mysql/get_server_information'
You might find the PHP example in0 -
In that tutorial, instead of using the username and password and the CURLOPT_USERPWD lines as detailed in that, use the token and the header setting as per Authorization: cpanel
" instead of port 2087 and "Authorization: whm
" [QUOTE] But it doesn't work as well...((
In what way? And are you trying to run the script on the server itself or "remotely"?0 -
From my local machine it's working but from host a can't get informatin from API 0
Please sign in to leave a comment.
Comments
9 comments