如何使用php

时间:2017-05-16 21:41:56

标签: cpanel

我打算将域名从txt文件导入到cpanel作为别名域

我的cpanel帐户使用https协议,

我使用共享主机但无法访问whm

我找到了this代码,但无法在https协议中使用。

1 个答案:

答案 0 :(得分:0)

试试这个:

<?php

$cpanel_user = "";
$cpanel_passwd = "";
$cpanel_server = "";
$server_port = "2083"; // use 2082 for http
$theme = "paper-lantern"; 
$domains = file("domains.txt");

foreach($domains as $pdomain) {
        file_get_contents("https://$cpanel_user:$cpanel_passwd@$cpanel_server:$server_port/frontend/$cpanel_theme/park/doaddparked.html?domain=$pdomain&go=Add+Domain");

}

?>

当然在那里添加cpanel用户名/密码和服务器。 http也使用端口2082,https使用端口2083.不确定脚本是否能够处理cpanel会话内容(我现在没有cpanel帐户和域名进行测试,所以我无法检查是否该脚本实际上是否正常工作)。我在脚本中使用了 paper_lantern 主题,因为这是较新的cPanel / WHM版本的默认主题。