在哪里可以找到本地主机和实时服务器上的 CPANEL 对象文件路径
Where to find CPANEL object file Path on Localhost and Live server
抱歉,如果我的问题听起来很愚蠢。我正在尝试使用 LiveAPI.php 使用 Cpanel UAPI 创建一个电子邮件地址,但我似乎迷失了一些代码。
创建电子邮件地址的文档来自https://api.docs.cpanel.net/openapi/cpanel/operation/add_pop/
我根据文档使用此代码
<?php
//--------------------------------------------------------------------------------------
// Instructions:
//--------------------------------------------------------------------------------------
// 1) cd /usr/local/cpanel/base/frontend/paper_lantern
// 2) mkdir api_examples
// 3) cd api_examples
// 4) create a file Email_add_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/paper_lantern/
// to .../frontend/paper_lantern/api_examples/Email_add_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',
'add_pop',
array (
'email' => 'zomba',
'password' => '123456luggage',
'domain' => 'example.com',
'quota' => 'unlimited',
'send_welcome_email' => '1',
'skip_update_db' => '0',
)
);
// 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);
}
我不明白的是来自
这里
<?php
//--------------------------------------------------------------------------------------
// Instructions:
//--------------------------------------------------------------------------------------
// 1) cd /usr/local/cpanel/base/frontend/paper_lantern
// 2) mkdir api_examples
// 3) cd api_examples
// 4) create a file Email_add_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/paper_lantern/
// to .../frontend/paper_lantern/api_examples/Email_add_pop.live.php
//--------------------------------------------------------------------------------------
// Instantiate the CPANEL object.
require_once "/usr/local/cpanel/php/cpanel.php";
?>
到此为止。
我在哪里可以找到
require_once "/usr/local/cpanel/php/cpanel.php";
我不明白那句话。
我看到这个论坛 post https://forums.cpanel.net/threads/using-cpanel-uapi-in-from-my-php.672337/ 有我的确切问题,但在阅读之后,我更加困惑,点击链接寻求更多帮助,结果页面已贬值。
我在这里检查了 Whosebug cpanel-uapi 标签https://whosebug.com/questions/tagged/cpanel-uapi 没有答案
谁知道我需要学习、安装或正确设置什么?
您可以在此处的 cPanel github 上找到 api:
https://github.com/CpanelInc/publicapi-php
抱歉,如果我的问题听起来很愚蠢。我正在尝试使用 LiveAPI.php 使用 Cpanel UAPI 创建一个电子邮件地址,但我似乎迷失了一些代码。
创建电子邮件地址的文档来自https://api.docs.cpanel.net/openapi/cpanel/operation/add_pop/
我根据文档使用此代码
<?php
//--------------------------------------------------------------------------------------
// Instructions:
//--------------------------------------------------------------------------------------
// 1) cd /usr/local/cpanel/base/frontend/paper_lantern
// 2) mkdir api_examples
// 3) cd api_examples
// 4) create a file Email_add_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/paper_lantern/
// to .../frontend/paper_lantern/api_examples/Email_add_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',
'add_pop',
array (
'email' => 'zomba',
'password' => '123456luggage',
'domain' => 'example.com',
'quota' => 'unlimited',
'send_welcome_email' => '1',
'skip_update_db' => '0',
)
);
// 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);
}
我不明白的是来自
这里
<?php
//--------------------------------------------------------------------------------------
// Instructions:
//--------------------------------------------------------------------------------------
// 1) cd /usr/local/cpanel/base/frontend/paper_lantern
// 2) mkdir api_examples
// 3) cd api_examples
// 4) create a file Email_add_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/paper_lantern/
// to .../frontend/paper_lantern/api_examples/Email_add_pop.live.php
//--------------------------------------------------------------------------------------
// Instantiate the CPANEL object.
require_once "/usr/local/cpanel/php/cpanel.php";
?>
到此为止。
我在哪里可以找到
require_once "/usr/local/cpanel/php/cpanel.php";
我不明白那句话。
我看到这个论坛 post https://forums.cpanel.net/threads/using-cpanel-uapi-in-from-my-php.672337/ 有我的确切问题,但在阅读之后,我更加困惑,点击链接寻求更多帮助,结果页面已贬值。
我在这里检查了 Whosebug cpanel-uapi 标签https://whosebug.com/questions/tagged/cpanel-uapi 没有答案
谁知道我需要学习、安装或正确设置什么?
您可以在此处的 cPanel github 上找到 api: https://github.com/CpanelInc/publicapi-php