如何在cpanel中添加动态子域 [英] How to add a dynamic subdomain in cpanel

查看:99
本文介绍了如何在cpanel中添加动态子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本,可以让你在godaddy的cpanel中添加动态子域名。但问题是没有向cpanel添加子域。任何建议或帮助将不胜感激。谢谢。



我尝试过:



I have a PHP script that will let you add a dynamic subdomain in cpanel from godaddy. But the problem is not adding a subdomain to the cpanel. Any advice or help will be much appreciated thank you.

What I have tried:

$whmusername = "sample";
$whmpassword = "@sample";
$subdomain = "mytestdomain";
$rootdomain = "sample.com";


$query = "https://".$rootdomain.":2087/json-api/cpanel?user=".$whmusername."&cpanel_jsonapi_module= SubDomain&cpanel_jsonapi_func=addsubdomain&cpanel_jsonapi_version=2&domain=".$subdomain."&rootdomain=".$rootdomain;

$curl = curl_init();

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);

curl_setopt($curl, CURLOPT_HEADER,0);

curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);

$header[0] = "Authorization: Basic " . base64_encode($whmusername.":".$whmpassword) . "\n\r";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_URL, $query);
$result = curl_exec($curl);
if ($result == false) { error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");

} curl_close($curl);

print $result;

推荐答案

whmusername = sample;
whmusername = "sample";


whmpassword = @样品;
whmpassword = "@sample";


subdomain = mytestdomain;
subdomain = "mytestdomain";


这篇关于如何在cpanel中添加动态子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆