|
Version: 1
HCnix Build: 3.00 and later
API Build: 1.00 and later
Domain Manager - AddWebsite adds a website under a specified owner. This web service call can be made as http://your-domain.com/HCnixAPI/DomainManager.php?op=AddWebsite.
Input Parameters
HostUserName
HostPassword
ResellerName - owner name who is going to add website
WebsiteName - name of website to be added
OwnerName - webadmin name under which you want to add this website
WebsiteType - possible values are IPBased and NameBased
IPAddress - IP address of website (if WebsiteType parameter is set to IPBased), IPLessDomainIP (if WebsiteType parameter is set to NameBased)
|
|
Note : IP Address list can be retrieved using GetFreeIPList or GetIPLessDomainIPList method of ServerManager.
|
OptionalParam
DNSServerName - if sent, DNS will be created on specified server otherwise loadbalancing will be done
AllowAnonymous - True/False, default value will be set to True
ReadAcess - True/False, default value will be set to True
WriteAccess - True/False, default value will be set to False
ScriptSourceAccess - True/False, default value will be set to True
ExecuteAccess - True/False, default value will be set to False
DirectoryBrowsingAccess - True/False, default value will be set to False
EnableDefaultDocument - True/False, default value will be set to True
DefaultDocumentList - comma separated list of default documents for this website, default value will be set to "default.html,default.htm,default.php,index.htm,index.html,index.cfm,index.php"
TemporaryVirDirectory - send if you want to create temporary virtual directory in case of NameBased site
Language
Output Parameters
N/A
Sample Optional Parameters
<Parameters>
<Parameter Name = "AllowAnonymous ">True</Parameter>
<Parameter Name = "ReadAcess ">True</Parameter>
<Parameter Name = "WriteAccess">True</Parameter>
<Parameter Name = "ScriptSourceAccess">True</Parameter>
<Parameter Name = "ExecuteAccess">True</Parameter>
<Parameter Name = "DirectoryBrowsingAccess">True</Parameter>
<Parameter Name = "EnableDefaultDocument">True</Parameter>
<Parameter Name = "DefaultDocumentList ">default.html,default.htm,default.php,index.htm,index.html,index.cfm,index.php</Parameter>
<Parameter Name = "Language">French</Parameter>
</Parameters>
Sample SOAP Request
|
POST /HCnixAPI/DomainManager.php HTTP/1.1 Host: your-domain.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/AddWebsite" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <AddWebsite xmlns="http://tempuri.org/"> <HostUserName>host</HostUserName> <HostPassword>host123</HostPassword> <ResellerName>david</ResellerName> <WebsiteName>MyDomain.com</WebsiteName> <OwnerName>john</OwnerName> <WebsiteType>IPBased</WebsiteType> <IPAddress> 127.0.0.1 </IPAddress> <OptionalParam>xml</OptionalParam> </AddWebsite> </soap:Body> </soap:Envelope>
|
Sample HTTP Request
|
POST /HCnixAPI/DomainManager.php/AddWebsite HTTP/1.1 Host: your-domain.com Content-Type: application/x-www-form-urlencoded Content-Length: length HostUserName=host&HostPassword=host123&ResellerName=david&WebsiteName=MyDomain.com& OwnerName=john&WebsiteType=IPBased&IPAddress=127.0.0.1&OptionalParam=xml
|
Sample PHP Code
|
function AddWebsite($strHostUserName, $strHostPassword, $strResellerName, $strWebsiteName, $strOwnerName, $strWebsiteType, $strIPAddress, $OptionalParam) { $response=""; $soapPacket = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soap:Body> <AddWebsite xmlns=\"http://tempuri.org/\"> <HostUserName>$strHostUserName</HostUserName> <HostPassword>$strHostPassword</HostPassword> <ResellerName>$strResellerName</ResellerName> <WebsiteName>$strWebsiteName</WebsiteName> <OwnerName>$strOwnerName</OwnerName> <WebsiteType>$strWebsiteType</WebsiteType> <IPAddress>$strIPAddress</IPAddress> <OptionalParam>$OptionalParam</OptionalParam> </AddWebsite> </soap:Body> </soap:Envelope>"; // where $domain_name is where HCnix APIs are installed $fp = fsockopen($domain_name, 80, $errNo, $errString, 90); if($fp) { // where $name is the Virtual Directory name for HCnix APIs $header = "POST /$name/UserManager.php HTTP/1.1\r\n"; $header .= "HOST: $domain_name\n"; $header .= "Content-Type: text/xml;charset=\"utf-8\"\r\n"; $header .= "Content-Length: ".strlen($soapPacket)."\r\n\r\n"; fwrite($fp, $header.$soapPacket);
while (true) { $buffer = fread($fp, 1000); if( $buffer != "" ) $response .= $buffer; if(strstr($response, '</SOAP-ENV:Envelope>') || $buffer == "" ) break; $buffer = ""; } fclose($fp); $result = explode("<?xml",$response); return "<?xml".$result[1]; } }
|
Sample Response
|
<Response> <Method>AddWebsite</ Method> <Status>true</Status> <ErrorCode>70700011</ErrorCode> <ErrorDescription>Website created successfully.</ErrorDescription> <Result/> </Response>
|