Home > database >  API with ASP program to connect and open the cPanel space
API with ASP program to connect and open the cPanel space

Time:09-25

CPanel is the world's most famous, the highest utilization rate of a virtual host management panel, main is to use on the Linux server, run the PHP + MySQL web sites, cPanel has its own server management background, called WHM, in this background, can open, modify, suspend, delete virtual host space, there are many operations to the server, on the WHM platform, open space steps is: first, create a package, is the space type, set the space size, number of binding domain name, mail number, etc., and then in the open space operations there input domain, can open space after the choice space type, then the opening of the process, and it will be like a hand customer orders on our platform or open space, also need to manually open space on the WHM, in order to facilitate everybody in China, outside the star platforms such as automatic opened the space of cPanel, I according to the API documentation of cPanel, wrote the following ASP program, everyone can be integrated in your system, implement directly on your platform can open space of cPanel,

The set XMLHTTP=Createobject (" MSXML2. ServerXMLHTTP ")
Hosturl="http://" & amp; Hip&" ://2086/"hip is the server's IP
Hosturl XMLHTTP. Open the "POST", false, "root", HTTP://www.zhaomu.com//www.zhaomu.com is the server password
XMLHTTP. SetRequestHeader content-type ", "" application/x - WWW - form - urlencoded"
XmlHttp. Send a null

//the code above is used for the initial connection cPanel panel

Hosturl="http://" & amp; Hip&" : 2086/json API/createacct "//createacc is cPanel API is a function of
Sendin="username=" & amp; Youruser&" & The plan="& amp; Yourplan&" & IP=n& Reseller=0 & amp; Password="yourpass&" & Contactemail="& amp; Youremail&" & Domain="& amp; Yourdomain
//youruser yourplan, youpass, youremail, yourdomain FTP user name, room type name, FTP password, customer mail, domain names,
XMLHTTP. Open the "POST", hosturl, false
XMLHTTP. SetRequestHeader content-type ", "" application/x - WWW - form - urlencoded"
XMLHTTP. Send sendin
Sendout=XMLHTTP. The responseText
The Set XMLHTTP=nothing

//the code above is the implementation of open space of API

If instr (sendout, "" "status ": 1) & gt; 0 then

//opened after a successful operation

The else

//opened failure error

End the if
  • Related