cPanel doc says
To call a UAPI function with an API token, run the following command from the command line:
curl -H’Authorization: cpanel username:APITOKEN’ ‘https://example.com:2083/execute/Module/function?parameter=value’
Item Description Example
username The cPanel account’s username. username
APITOKEN The API token. U7HMR63FGY292DQZ4H5BFH16JLYMO01M
example.com Your cPanel server’s domain example.com
Module The API module name. Email
function The API function’s name. add_pop
parameter The function’s input parameters. email
value The value to assign to the input parameter. 12345luggage
For example, your command may resemble the following example:
curl -H’Authorization: cpanel username:U7HMR63FHY282DQZ4H5BIH16JLYSO01M’ ‘https://example.com:2083/execute/Email/add_pop?email=newuser&password=12345luggage’
- source: https://api.docs.cpanel.net/cpanel/tokens/
I am also make a function in my controller
public function test()
{
$response = Http::post('https://example.com:2083' ,[
'username' => 'holidays',
'APITOKEN' => 'XPA6V9NSZ5JGKXU5VE2X214U53WROFI0',
'Module' => 'Email',
'function' => 'add_pop',
'parameter' => 'email',
'value' => 'test',
]);
return $response;
// dd($response);
}
how can i send it correctly to cPanel for make a new email… and get a successful massage
thank you
send request to create a new email & get return success massage in Laravel 10