Файл: _rootinc/regru.inc.php
Строк: 791
<?
class REGRU
{
public $url=null;
public $user=null;
public $password = null;
public $errors=array();
public $fp=null;
public function init($url,$user,$password)
{
$this->url=$url;
$this->user=$user;
$this->password=$password;
}
public function connect($api_path)
{
$api_path = iconv("utf-8","windows-1251",htmlDecode($api_path));
$this->fp = curl_init();
curl_setopt($this->fp, CURLOPT_URL, $this->url);
curl_setopt($this->fp, CURL_HTTP_VERSION_1_0, 1);
curl_setopt($this->fp, CURLOPT_POST, 1);
curl_setopt($this->fp, CURLOPT_POSTFIELDS, $api_path);
curl_setopt($this->fp, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($this->fp, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($this->fp, CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->fp, CURLOPT_TIMEOUT, 120);
$result = curl_exec($this->fp);
$result = iconv("windows-1251","utf-8",$result);
return $result;
}
public function disconnect()
{
curl_close($this->fp);
}
public function regRuDomainOrg($domain,$period,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$ns0ip,$ns1ip,$ns2ip,$ns3ip,$org,$org_r,$code,$kpp,$country,$address_r,$p_addr,$phone,$fax,$e_mail)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&ns0ip=$ns0ip&ns1ip=$ns1ip&ns2ip=$ns2ip&ns3ip=$ns3ip&org=$org&org_r=$org_r&code=$code&kpp=$kpp&country=$country&address_r=$address_r&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function regRuDomainPerson($domain,$period,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$ns0ip,$ns1ip,$ns2ip,$ns3ip,$person,$private_person_flag,$person_r,$passport,$birth_date,$country,$p_addr,$phone,$fax,$e_mail,$code)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&ns0ip=$ns0ip&ns1ip=$ns1ip&ns2ip=$ns2ip&ns3ip=$ns3ip&person=$person&private_person_flag=$private_person_flag&person_r=$person_r&passport=$passport&birth_date=$birth_date&country=$country&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail&code=$code&");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function transferRuDomain($domain,$period,$fail_if_no_money,$no_bill_notify)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_trans_in&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function regEtcDomain($domain,$period,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$ns0ip,$ns1ip,$ns2ip,$ns3ip,$o_company,$o_first_name,$o_last_name,$o_email,$o_phone,$o_fax,$o_addr,$o_city,$o_state,$o_postcode,$o_country_code)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_create&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&ns0ip=$ns0ip&ns1ip=$ns1ip&ns2ip=$ns2ip&ns3ip=$ns3ip&o_company=$o_company&o_first_name=$o_first_name&o_last_name=$o_last_name&o_email=$o_email&o_phone=".urlencode($o_phone)."&o_fax=".urlencode($o_fax)."&o_addr=$o_addr&o_city=$o_city&o_state=$o_state&o_postcode=$o_postcode&o_country_code=$o_country_code&a_company=$o_company&a_first_name=$o_first_name&a_last_name=$o_last_name&a_email=$o_email&a_phone=".urlencode($o_phone)."&a_fax=".urlencode($o_fax)."&a_addr=$o_addr&a_city=$o_city&a_state=$o_state&a_postcode=$o_postcode&a_country_code=$o_country_code&t_company=$o_company&t_first_name=$o_first_name&t_last_name=$o_last_name&t_email=$o_email&t_phone=".urlencode($o_phone)."&t_fax=".urlencode($o_fax)."&t_addr=$o_addr&t_city=$o_city&t_state=$o_state&t_postcode=$o_postcode&t_country_code=$o_country_code&b_company=$o_company&b_first_name=$o_first_name&b_last_name=$o_last_name&b_email=$o_email&b_phone=".urlencode($o_phone)."&b_fax=".urlencode($o_fax)."&b_addr=$o_addr&b_city=$o_city&b_state=$o_state&b_postcode=$o_postcode&b_country_code=$o_country_code");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function transferEtcDomain($domain,$period,$authinfo,$fail_if_no_money,$no_bill_notify,$ns0,$ns1,$ns2,$ns3,$ns0ip,$ns1ip,$ns2ip,$ns3ip,$o_company,$o_first_name,$o_last_name,$o_email,$o_phone,$o_fax,$o_addr,$o_city,$o_state,$o_postcode,$o_country_code) {
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_trans_in&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&authinfo=$authinfo&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&ns0ip=$ns0ip&ns1ip=$ns1ip&ns2ip=$ns2ip&ns3ip=$ns3ip&o_company=$o_company&o_first_name=$o_first_name&o_last_name=$o_last_name&o_email=$o_email&o_phone=".urlencode($o_phone)."&o_fax=".urlencode($o_fax)."&o_addr=$o_addr&o_city=$o_city&o_state=$o_state&o_postcode=$o_postcode&o_country_code=$o_country_code&a_company=$o_company&a_first_name=$o_first_name&a_last_name=$o_last_name&a_email=$o_email&a_phone=".urlencode($o_phone)."&a_fax=".urlencode($o_fax)."&a_addr=$o_addr&a_city=$o_city&a_state=$o_state&a_postcode=$o_postcode&a_country_code=$o_country_code&t_company=$o_company&t_first_name=$o_first_name&t_last_name=$o_last_name&t_email=$o_email&t_phone=".urlencode($o_phone)."&t_fax=".urlencode($o_fax)."&t_addr=$o_addr&t_city=$o_city&t_state=$o_state&t_postcode=$o_postcode&t_country_code=$o_country_code&b_company=$o_company&b_first_name=$o_first_name&b_last_name=$o_last_name&b_email=$o_email&b_phone=".urlencode($o_phone)."&b_fax=".urlencode($o_fax)."&b_addr=$o_addr&b_city=$o_city&b_state=$o_state&b_postcode=$o_postcode&b_country_code=$o_country_code");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function renewDomain($domain, $period, $fail_if_no_money, $no_bill_notify)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_renew&username=".$this->user."&password=".$this->password."&domain_name=$domain&period=$period&fail_if_no_money=$fail_if_no_money&no_bill_notify=$no_bill_notify&");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function getNS($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 = "getNS: $d->last_error";;
return false;
}
}
public function updateNS($domain,$ns0,$ns1,$ns2,$ns3,$ns0ip,$ns1ip,$ns2ip,$ns3ip)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_update_nss&username=".$this->user."&password=".$this->password."&domain_name=$domain&ns0=$ns0&ns1=$ns1&ns2=$ns2&ns3=$ns3&ns0ip=$ns0ip&ns1ip=$ns1ip&ns2ip=$ns2ip&ns3ip=$ns3ip&");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function updateRuDomainOrg($domain,$org,$org_r,$code,$kpp,$country,$address_r,$p_addr,$phone,$fax,$e_mail)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_update_contacts&username=".$this->user."&password=".$this->password."&domain_name=$domain&kpp=$kpp&country=$country&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function updateRuDomainPerson($domain,$person,$private_person_flag,$person_r,$passport,$birth_date,$country,$p_addr,$phone,$fax,$e_mail,$code)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_update_contacts&username=".$this->user."&password=".$this->password."&domain_name=$domain&private_person_flag=$private_person_flag&country=$country&p_addr=$p_addr&phone=".urlencode($phone)."&fax=".urlencode($fax)."&e_mail=$e_mail&code=$code&");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function updateEtcDomain($domain,$o_company,$o_first_name,$o_last_name,$o_email,$o_phone,$o_fax,$o_addr,$o_city,$o_state,$o_postcode,$o_country_code)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_update_contacts&username=".$this->user."&password=".$this->password."&domain_name=$domain&o_first_name=$o_first_name&o_last_name=$o_last_name&o_email=$o_email&o_phone=".urlencode($o_phone)."&o_fax=".urlencode($o_fax)."&o_addr=$o_addr&o_city=$o_city&o_state=$o_state&o_postcode=$o_postcode&o_country_code=$o_country_code&a_company=$o_company&a_first_name=$o_first_name&a_last_name=$o_last_name&a_email=$o_email&a_phone=".urlencode($o_phone)."&a_fax=".urlencode($o_fax)."&a_addr=$o_addr&a_city=$o_city&a_state=$o_state&a_postcode=$o_postcode&a_country_code=$o_country_code&t_company=$o_company&t_first_name=$o_first_name&t_last_name=$o_last_name&t_email=$o_email&t_phone=".urlencode($o_phone)."&t_fax=".urlencode($o_fax)."&t_addr=$o_addr&t_city=$o_city&t_state=$o_state&t_postcode=$o_postcode&t_country_code=$o_country_code&b_company=$o_company&b_first_name=$o_first_name&b_last_name=$o_last_name&b_email=$o_email&b_phone=".urlencode($o_phone)."&b_fax=".urlencode($o_fax)."&b_addr=$o_addr&b_city=$o_city&b_state=$o_state&b_postcode=$o_postcode&b_country_code=$o_country_code");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
public function updateRuDomainPrivatePerson($domain,$private_person_flag)
{
# if (preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) {
# $idna = new idna_convert();
# $domain = $idna->encode($domain);
# }
//connect using prpoer xml api address
$result = $this->connect("action=domain_update_private_person_flag&username=".$this->user."&password=".$this->password."&domain_name=$domain&private_flag=$private_person_flag&");
if($result=='')
{
$this->errors[]='No output.';
return false;
}
//disconnect
$this->disconnect();
if (preg_match("/Error:/ui",$result)) {
$this->errors[] = "$result";
return false;
break;
} else if (preg_match("/Success:/ui",$result)) {
return true;
break;
}
}
}
?>