Файл: _rootinc/rootpanelapi.inc.php
Строк: 300
<?
class ROOTPANELAPI
{
public $url = null;
public $login = null;
public $apikey = null;
public $error = null;
public function init($url,$login,$apikey)
{
$this->url = $url;
$this->login = $login;
$this->apikey = $apikey;
}
public function send($params)
{
while (list($k,$v) = @each($params)) {
$req = $req."$k=".urlencode($v)."&";
}
$fp = curl_init();
curl_setopt($fp, CURLOPT_URL, $this->url);
curl_setopt($fp, CURLOPT_RETURNTRANSFER, true);
curl_setopt($fp, CURLOPT_POST, true);
curl_setopt($fp, CURLOPT_POSTFIELDS, $req);
curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($fp, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($fp, CURLOPT_FAILONERROR, false);
curl_setopt($fp, CURLOPT_TIMEOUT, 120);
$result = curl_exec($fp);
if (curl_errno($fp)) {
$this->error = "cURL Error ".curl_errno($fp).": ".curl_error($fp);
curl_close($fp);
return false;
} else {
curl_close($fp);
$result = unserialize($result);
if (is_array($result) and count($result) > 1) {
return $result;
} else {
$this->error = "send: No output";
return false;
}
}
}
public function createProfile($org, $surname, $name, $otchestvo, $firma, $firmaeng, $country, $oblast, $post, $city, $street, $komu, $address_org, $phone, $mobile, $fax, $email, $seriya, $by, $date, $birthday, $inn, $kpp, $okonh, $okpo, $bank, $bank_schet, $bank_bik, $edrpou, $socstrahnumber, $idnum, $ogrn, $ogrn_by, $ogrn_date, $icq, $skype, $ripe, $ripn, $uanic, $dpnic, $epnic, $eunic)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "createProfile";
$params["org"] = $org;
$params["surname"] = $surname;
$params["name"] = $name;
$params["otchestvo"] = $otchestvo;
$params["firma"] = $firma;
$params["firmaeng"] = $firmaeng;
$params["country"] = $country;
$params["oblast"] = $oblast;
$params["post"] = $post;
$params["city"] = $city;
$params["street"] = $street;
$params["komu"] = $komu;
$params["address_org"] = $address_org;
$params["phone"] = $phone;
$params["mobile"] = $mobile;
$params["fax"] = $fax;
$params["email"] = $email;
$params["seriya"] = $seriya;
$params["by"] = $by;
$params["date"] = $date;
$params["birthday"] = $birthday;
$params["inn"] = $inn;
$params["kpp"] = $kpp;
$params["okonh"] = $okonh;
$params["okpo"] = $okpo;
$params["bank"] = $bank;
$params["bank_schet"] = $bank_schet;
$params["bank_bik"] = $bank_bik;
$params["edrpou"] = $edrpou;
$params["socstrahnumber"] = $socstrahnumber;
$params["idnum"] = $idnum;
$params["ogrn"] = $ogrn;
$params["ogrn_by"] = $ogrn_by;
$params["ogrn_date"] = $ogrn_date;
$params["icq"] = $icq;
$params["skype"] = $skype;
$params["ripe"] = $ripe;
$params["ripn"] = $ripn;
$params["uanic"] = $uanic;
$params["dpnic"] = $dpnic;
$params["epnic"] = $epnic;
$params["eunic"] = $eunic;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return $result[profileid];
} else {
$this->error = "createProfile: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
public function updateProfile($profileid, $surname, $name, $otchestvo, $firma, $firmaeng, $country, $oblast, $post, $city, $street, $komu, $address_org, $phone, $mobile, $fax, $email, $seriya, $by, $date, $birthday, $inn, $kpp, $okonh, $okpo, $bank, $bank_schet, $bank_bik, $edrpou, $socstrahnumber, $idnum, $ogrn, $ogrn_by, $ogrn_date, $icq, $skype, $ripe, $ripn, $uanic, $dpnic, $epnic, $eunic)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "createProfile";
$params["profileid"] = "profileid";
$params["surname"] = $surname;
$params["name"] = $name;
$params["otchestvo"] = $otchestvo;
$params["firma"] = $firma;
$params["firmaeng"] = $firmaeng;
$params["country"] = $country;
$params["oblast"] = $oblast;
$params["post"] = $post;
$params["city"] = $city;
$params["street"] = $street;
$params["komu"] = $komu;
$params["address_org"] = $address_org;
$params["phone"] = $phone;
$params["mobile"] = $mobile;
$params["fax"] = $fax;
$params["email"] = $email;
$params["seriya"] = $seriya;
$params["by"] = $by;
$params["date"] = $date;
$params["birthday"] = $birthday;
$params["inn"] = $inn;
$params["kpp"] = $kpp;
$params["okonh"] = $okonh;
$params["okpo"] = $okpo;
$params["bank"] = $bank;
$params["bank_schet"] = $bank_schet;
$params["bank_bik"] = $bank_bik;
$params["edrpou"] = $edrpou;
$params["socstrahnumber"] = $socstrahnumber;
$params["idnum"] = $idnum;
$params["ogrn"] = $ogrn;
$params["ogrn_by"] = $ogrn_by;
$params["ogrn_date"] = $ogrn_date;
$params["icq"] = $icq;
$params["skype"] = $skype;
$params["ripe"] = $ripe;
$params["ripn"] = $ripn;
$params["uanic"] = $uanic;
$params["dpnic"] = $dpnic;
$params["epnic"] = $epnic;
$params["eunic"] = $eunic;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return $result[profileid];
} else {
$this->error = "updateProfile: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
public function registerDomain($domain,$registratorid,$period,$profileid,$defaultns,$ns1,$ns2,$ns3,$ns4,$ns1ip,$ns2ip,$ns3ip,$ns4ip)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "registerDomain";
$params["domain"] = $domain;
$params["registratorid"] = $registratorid;
$params["period"] = $period;
$params["profileid"] = $profileid;
$params["defaultns"] = $defaultns;
$params["ns1"] = $ns1;
$params["ns2"] = $ns2;
$params["ns3"] = $ns3;
$params["ns4"] = $ns4;
$params["ns1ip"] = $ns1ip;
$params["ns2ip"] = $ns2ip;
$params["ns3ip"] = $ns3ip;
$params["ns4ip"] = $ns4ip;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return $result[profileid];
} else {
$this->error = "registerDomain: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
public function renewDomain($domain,$period)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "renewDomain";
$params["domain"] = $domain;
$params["period"] = $period;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return true;
} else {
$this->error = "renewDomain: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
public function updateDomainContacts($domain,$profileid)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "updateDomainContacts";
$params["domain"] = $domain;
$params["profileid"] = $profileid;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return true;
} else {
$this->error = "updateDomainContacts: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
public function getDNS($domain)
{
$d = new domain($domain);
$result = $d->info();
if (!$d->last_error) {
$result1 = mb_split("n", $result);
while (list($index,$res) = each($result1)) {
if (preg_match("/nserver/ui",$res)) {
preg_match("/nserver:s*(.*)/iu",$res,$arr);
$resultarray[]=$arr[1];
} else if (preg_match("/Name Server/ui",$res)) {
preg_match("/Name Server:s*(.*)/iu",$res,$arr);
$resultarray[]=$arr[1];
}
}
return $resultarray;
} else {
$this->error = "getDNS: $d->last_error";;
return false;
}
}
public function updateDNS($domain,$defaultns,$ns1,$ns2,$ns3,$ns4,$ns1ip,$ns2ip,$ns3ip,$ns4ip)
{
$params["login"] = $this->login;
$params["apikey"] = $this->apikey;
$params["command"] = "updateDNS";
$params["domain"] = $domain;
$params["defaultns"] = $defaultns;
$params["ns1"] = $ns1;
$params["ns2"] = $ns2;
$params["ns3"] = $ns3;
$params["ns4"] = $ns4;
$params["ns1ip"] = $ns1ip;
$params["ns2ip"] = $ns2ip;
$params["ns3ip"] = $ns3ip;
$params["ns4ip"] = $ns4ip;
$result = $this->send($params);
if ($result) {
if ($result[status] == "SUCCESS") {
return true;
} else {
$this->error = "updateDNS: Code ".$result[errorCode].", ".$result[errorMsg];
return false;
}
}
else {
return false;
}
}
}
?>