Вход Регистрация
Файл: _rootinc/networking4all.inc.php
Строк: 381
<?

class NETWORKING4ALL
{
    private 
$handle null;
    private 
$client null;
    private 
$requestHeader null;

    public 
$error null;

    public function 
init($url,$user,$password,$handle)
    {
        @
ini_set("soap.wsdl_cache_enabled""0");
        @
use_soap_error_handler(true);

        
$this->handle $handle;

        
$this->client = new SoapClient($url, array('trace' => 1'exceptions' => false));

        
$this->requestHeader = array();
        
$this->requestHeader['auth']['handle'] = $handle;
        
$this->requestHeader['auth']['username'] = $user;
        
$this->requestHeader['auth']['password'] = $password;
        
$this->requestHeader['language'] = 'EN';
        
$this->requestHeader['test'] = 0;
    }

    private function 
getError($result) {
        if (
is_array($result->responseHeader->errors->error)) {
            
$error "Code: ".$result->responseHeader->errors->error[0]->code.", ".$result->responseHeader->errors->error[0]->message;
        } else {
            
$error "Code: ".$result->responseHeader->errors->error->code.", ".$result->responseHeader->errors->error->message;
        }

        return 
$error;
    }

    public function 
createContact($initials$firstName$middleName$lastName$street$postalCode$city$province$countryCode$phoneNumber$faxNumber$mobileNumber$email)
    {
        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['type'] = 'contact';
        
$params['request']['handle'] = $this->handle;

        
$params['request']['contact']['initials'] = $initials;
        
$params['request']['contact']['firstName'] = $firstName;
        
$params['request']['contact']['middleName'] = $middleName;
        
$params['request']['contact']['lastName'] = $lastName;

        
$address = array();
        
$address['type'] = 'visit';
        
$address['street1'] = $street;
        
$address['postalCode'] = $postalCode;
        
$address['city'] = $city;
        
$address['province'] = $province;
        
$address['countryCode'] = $countryCode;
        
$params['request']['address'][] = $address;

        
$params['request']['phoneNumber'] = $phoneNumber;
        
$params['request']['faxNumber'] = $faxNumber;
        
$params['request']['mobileNumber'] = $mobileNumber;
        
$params['request']['email'] = $email;

        
$params['request']['option']['createAccount'] = '0';

        
$result $this->client->createRelation($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
$result->response->handle;
        } else {
            
$this->error "createContact: ".$this->getError($result);
        }
      }

    public function 
updateContact($handle$initials$firstName$middleName$lastName$street$postalCode$city$province$countryCode$phoneNumber$faxNumber$mobileNumber$email)
    {
        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['type'] = 'contact';
        
$params['request']['handle'] = $handle;

        
$params['request']['contact']['initials'] = $initials;
        
$params['request']['contact']['firstName'] = $firstName;
        
$params['request']['contact']['middleName'] = $middleName;
        
$params['request']['contact']['lastName'] = $lastName;

        
$address = array();
        
$address['type'] = 'visit';
        
$address['street1'] = $street;
        
$address['postalCode'] = $postalCode;
        
$address['city'] = $city;
        
$address['province'] = $province;
        
$address['countryCode'] = $countryCode;
        
$params['request']['address'][] = $address;

        
$params['request']['phoneNumber'] = $phoneNumber;
        
$params['request']['faxNumber'] = $faxNumber;
        
$params['request']['mobileNumber'] = $mobileNumber;
        
$params['request']['email'] = $email;

        
$params['request']['option']['createAccount'] = '0';

        
$result $this->client->updateRelation($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "updateContact: ".$this->getError($result);
        }
      }

    public function 
deleteContact($handle)
    {
        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['handle'] = $handle;

        
$result $this->client->deleteRelation($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "deleteContact: ".$this->getError($result);
        }
      }

    public function 
registerDomain($domain$handle$ns1$ns2$ns3$ns4$ns1ip$ns2ip$ns3ip$ns4ip)
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['action'] = "register";
        
$params['request']['domain'] = $domain;

        
$params['request']['companyHandle'] = $this->handle;
        
$params['request']['adminHandle'] = $handle;
        
$params['request']['techHandle'] = $handle;

        if (
$ns1) {
            
$params['request']['nameServers'][0]['ns'] = $ns1;
            if (
$ns1ip) {
                
$params['request']['nameServers'][0]['ipv4'] = $ns1ip;
            }
        }
        if (
$ns2) {
            
$params['request']['nameServers'][1]['ns'] = $ns2;
            if (
$ns2ip) {
                
$params['request']['nameServers'][1]['ipv4'] = $ns2ip;
            }
        }
        if (
$ns3) {
            
$params['request']['nameServers'][2]['ns'] = $ns3;
            if (
$ns3ip) {
                
$params['request']['nameServers'][2]['ipv4'] = $ns3ip;
            }
        }
        if (
$ns4) {
            
$params['request']['nameServers'][3]['ns'] = $ns4;
            if (
$ns4ip) {
                
$params['request']['nameServers'][3]['ipv4'] = $ns4ip;
            }
        }

        
$result $this->client->orderDomain($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "registerDomain: ".$this->getError($result);
        }
      }

    public function 
transferDomain($domain$handle$auth$ns1$ns2$ns3$ns4$ns1ip$ns2ip$ns3ip$ns4ip)
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['action'] = "transfer";
        
$params['request']['domain'] = $domain;
        if (
$auth) { $params['request']['authCode'] = $auth; }

        
$params['request']['companyHandle'] = $this->handle;
        
$params['request']['adminHandle'] = $handle;
        
$params['request']['techHandle'] = $handle;

        if (
$ns1) {
            
$params['request']['nameServers'][0]['ns'] = $ns1;
            if (
$ns1ip) {
                
$params['request']['nameServers'][0]['ipv4'] = $ns1ip;
            }
        }
        if (
$ns2) {
            
$params['request']['nameServers'][1]['ns'] = $ns2;
            if (
$ns2ip) {
                
$params['request']['nameServers'][1]['ipv4'] = $ns2ip;
            }
        }
        if (
$ns3) {
            
$params['request']['nameServers'][2]['ns'] = $ns3;
            if (
$ns3ip) {
                
$params['request']['nameServers'][2]['ipv4'] = $ns3ip;
            }
        }
        if (
$ns4) {
            
$params['request']['nameServers'][3]['ns'] = $ns4;
            if (
$ns4ip) {
                
$params['request']['nameServers'][3]['ipv4'] = $ns4ip;
            }
        }

        
$result $this->client->orderDomain($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "transferDomain: ".$this->getError($result);
        }
      }

    public function 
getNS($domain)
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['domain'] = $domain;

        
$result $this->client->getDomain($params);

        if (
$result->responseHeader->resultCode == 0) {
            if (
$result->response->nameServers[0]->ns) { $res[] = $result->response->nameServers[0]->ns; }
            if (
$result->response->nameServers[1]->ns) { $res[] = $result->response->nameServers[1]->ns; }
            if (
$result->response->nameServers[2]->ns) { $res[] = $result->response->nameServers[2]->ns; }
            if (
$result->response->nameServers[3]->ns) { $res[] = $result->response->nameServers[3]->ns; }

            return 
$res;
        } else {
            
$this->error "getNS: ".$this->getError($result);
        }
      }

    public function 
updateNS($domain$ns1$ns2$ns3$ns4$ns1ip$ns2ip$ns3ip$ns4ip)
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['domain'] = $domain;

        if (
$ns1) {
            
$params['request']['nameServers'][0]['ns'] = $ns1;
            if (
$ns1ip) {
                
$params['request']['nameServers'][0]['ipv4'] = $ns1ip;
            }
        }
        if (
$ns2) {
            
$params['request']['nameServers'][1]['ns'] = $ns2;
            if (
$ns2ip) {
                
$params['request']['nameServers'][1]['ipv4'] = $ns2ip;
            }
        }
        if (
$ns3) {
            
$params['request']['nameServers'][2]['ns'] = $ns3;
            if (
$ns3ip) {
                
$params['request']['nameServers'][2]['ipv4'] = $ns3ip;
            }
        }
        if (
$ns4) {
            
$params['request']['nameServers'][3]['ns'] = $ns4;
            if (
$ns4ip) {
                
$params['request']['nameServers'][3]['ipv4'] = $ns4ip;
            }
        }

        
$result $this->client->nameServerChange($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "updateNS: ".$this->getError($result);
        }
      }

    public function 
disableAutoRenew($domain
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['domain'] = $domain;
        
$params['request']['status'] = "noautorenew";

        
$result $this->client->updateDomain($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "disableAutoRenew: ".$this->getError($result);
        }
    }

    public function 
enableAutoRenew($domain
    {
        if (
preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]/ui",$domain)) { $idna = new idna_convert(); $domain $idna->encode($domain); }

        
$params = array();
        
$params['requestHeader'] = $this->requestHeader;

        
$params['request']['domain'] = $domain;
        
$params['request']['status'] = "autorenew";

        
$result $this->client->updateDomain($params);

        if (
$result->responseHeader->resultCode == 0) {
            return 
true;
        } else {
            
$this->error "enableAutoRenew: ".$this->getError($result);
        }
    }

}
?>
Онлайн: 0
Реклама