-
Notifications
You must be signed in to change notification settings - Fork 1
/
kuyyyy.php
54 lines (47 loc) · 1.8 KB
/
kuyyyy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
//--------------------------------------------------------------------------------------
// Instructions:
//--------------------------------------------------------------------------------------
// <theme-name> is the theme assigned to cPanel account.
// 1) cd /usr/local/cpanel/base/frontend/<theme-name>
// 2) mkdir api_examples
// 3) cd api_examples
// 4) create a file Email_passwd_pop.live.php and put this code into that file.
// 5) In your browser login to a cPanel account.
// 6) Manually change the url from: .../frontend/<theme-name>/
// to .../frontend/<theme-name>/api_examples/Email_passwd_pop.live.php
//--------------------------------------------------------------------------------------
// Instantiate the CPANEL object.
require_once "/usr/local/cpanel/php/cpanel.php";
// Print the header
header('Content-Type: text/plain');
// Connect to cPanel - only do this once.
$cpanel = new CPANEL();
// Call the API
$response = $cpanel->uapi(
'Email',
'passwd_pop',
array (
'email' => '[email protected]',
'password' => 'RahasiaPabrikG4n12@@',
)
);
// Handle the response
if ($response['cpanelresult']['result']['status']) {
$data = $response['cpanelresult']['result']['data'];
// Do something with the $data
// So you can see the data shape we print it here.
print to_json($data);
}
else {
// Report errors:
print to_json($response['cpanelresult']['result']['errors']);
}
// Disconnect from cPanel - only do this once.
$cpanel->end();
//--------------------------------------------------------------------------------------
// Helper function to convert a PHP value to html printable json
//--------------------------------------------------------------------------------------
function to_json($data) {
return json_encode($data, JSON_PRETTY_PRINT);
}