/** * saves contact details * * @param array $params * @return array */ function internetbs_SaveContactDetails($params) { $username = $params["Username"]; $password = $params["Password"]; $testmode = $params["TestMode"]; $tld = $params["tld"]; $sld = $params["sld"]; # Data is returned as specified in the GetContactDetails() function $firstname = $params["contactdetails"]["Registrant"]["First Name"]; $lastname = $params["contactdetails"]["Registrant"]["Last Name"]; $company = $params["contactdetails"]["Registrant"]["Company"]; $email = $params["contactdetails"]["Registrant"]["Email"]; $phonenumber = internetbs_reformatPhone($params["contactdetails"]["Registrant"]["Phone Number"], $params["contactdetails"]["Registrant"]["Country Code"]); $address1 = $params["contactdetails"]["Registrant"]["Address1"]; if (!$address1) { $address1 = $params["contactdetails"]["Registrant"]["Address 1"]; } $address2 = $params["contactdetails"]["Registrant"]["Address2"]; if (!$address2) { $address2 = $params["contactdetails"]["Registrant"]["Address 2"]; } $postalcode = $params["contactdetails"]["Registrant"]["Postcode"]; $city = $params["contactdetails"]["Registrant"]["City"]; $country = $params["contactdetails"]["Registrant"]["Country"]; $countrycode = $params["contactdetails"]["Registrant"]["Country Code"]; if (!$countrycode) { $countrycode = $country; } $adminfirstname = $params["contactdetails"]["Admin"]["First Name"]; $adminlastname = $params["contactdetails"]["Admin"]["Last Name"]; $adminCompany = $params["contactdetails"]["Admin"]["Company"]; $adminemail = $params["contactdetails"]["Admin"]["Email"]; $adminphonenumber = internetbs_reformatPhone($params["contactdetails"]["Admin"]["Phone Number"], $params["contactdetails"]["Admin"]["Country Code"]); $adminaddress1 = $params["contactdetails"]["Admin"]["Address1"]; if (!$adminaddress1) { $adminaddress1 = $params["contactdetails"]["Admin"]["Address 1"]; } $adminaddress2 = $params["contactdetails"]["Admin"]["Address2"]; if (!$adminaddress2) { $adminaddress2 = $params["contactdetails"]["Admin"]["Address 2"]; } $adminpostalcode = $params["contactdetails"]["Admin"]["Postcode"]; $admincity = $params["contactdetails"]["Admin"]["City"]; $admincountry = $params["contactdetails"]["Admin"]["Country"]; $admincountrycode = $params["contactdetails"]["Admin"]["Country Code"]; if (!$admincountrycode) { $admincountrycode = $admincountry; } $techfirstname = $params["contactdetails"]["Tech"]["First Name"]; $techlastname = $params["contactdetails"]["Tech"]["Last Name"]; $techCompany = $params["contactdetails"]["Tech"]["Company"]; $techemail = $params["contactdetails"]["Tech"]["Email"]; $techphonenumber = internetbs_reformatPhone($params["contactdetails"]["Tech"]["Phone Number"], $params["contactdetails"]["Tech"]["Country Code"]); $techaddress1 = $params["contactdetails"]["Tech"]["Address1"]; if (!$techaddress1) { $techaddress1 = $params["contactdetails"]["Tech"]["Address 1"]; } $techaddress2 = $params["contactdetails"]["Tech"]["Address2"]; if (!$techaddress2) { $techaddress2 = $params["contactdetails"]["Tech"]["Address 2"]; } $techpostalcode = $params["contactdetails"]["Tech"]["Postcode"]; $techcity = $params["contactdetails"]["Tech"]["City"]; $techcountry = $params["contactdetails"]["Tech"]["Country"]; $techcountrycode = $params["contactdetails"]["Tech"]["Country Code"]; if (!$techcountrycode) { $techcountrycode = $techcountry; } # Put your code to save new WHOIS data here $domainName = $sld . '.' . $tld; $apiServerUrl = $testmode == "on" ? API_TESTSERVER_URL : API_SERVER_URL; $commandUrl = $apiServerUrl . 'Domain/Update'; $data = array('apikey' => $username, 'password' => $password, 'domain' => $domainName, 'registrant_firstname' => $firstname, 'registrant_lastname' => $lastname, 'registrant_organization' => $company, 'registrant_street' => $address1, 'registrant_street2' => $address2, 'registrant_city' => $city, 'registrant_countrycode' => $countrycode, 'registrant_postalcode' => $postalcode, 'registrant_email' => $email, 'registrant_phonenumber' => $phonenumber, 'technical_firstname' => $techfirstname, 'technical_lastname' => $techlastname, 'technical_organization' => $techCompany, 'technical_street' => $techaddress1, 'technical_street2' => $techaddress2, 'technical_city' => $techcity, 'technical_countrycode' => $techcountrycode, 'technical_postalcode' => $techpostalcode, 'technical_email' => $techemail, 'technical_phonenumber' => $techphonenumber, 'admin_firstname' => $adminfirstname, 'admin_lastname' => $adminlastname, 'admin_organization' => $adminCompany, 'admin_street' => $adminaddress1, 'admin_street2' => $adminaddress2, 'admin_city' => $admincity, 'admin_countrycode' => $admincountrycode, 'admin_postalcode' => $adminpostalcode, 'admin_email' => $adminemail, 'admin_phonenumber' => $adminphonenumber, 'billing_firstname' => $adminfirstname, 'billing_lastname' => $adminlastname, 'admin_organization' => $adminCompany, 'billing_street' => $adminaddress1, 'billing_street2' => $adminaddress2, 'billing_city' => $admincity, 'billing_countrycode' => $admincountrycode, 'billing_postalcode' => $adminpostalcode, 'billing_email' => $adminemail, 'billing_phonenumber' => $adminphonenumber); $extarr = explode('.', $tld); $ext = array_pop($extarr); // Unset params which is not possible update for domain if ('it' == $ext) { unset($data['registrant_countrycode']); unset($data['registrant_organization']); unset($data['registrant_countrycode']); unset($data['registrant_country']); unset($data['registrant_dotitentitytype']); unset($data['registrant_dotitnationality']); unset($data['registrant_dotitregcode']); } if ($ext == 'eu' || $ext == 'be') { if (!strlen(trim($data['registrant_organization']))) { unset($data['registrant_firstname']); unset($data['registrant_lastname']); } unset($data['registrant_organization']); } if ($ext == "co.uk" || $ext == "org.uk" || $ext == "me.uk" || $ext == 'uk') { unset($data['registrant_firstname']); unset($data['registrant_lastname']); } if ($ext == "fr" || $ext == "re") { unset($data['registrant_firstname']); unset($data['registrant_lastname']); unset($data['registrant_countrycode']); unset($data['registrant_countrycode']); if (!strlen(trim($data['admin_dotfrcontactentitysiren']))) { unset($data['admin_dotfrcontactentitysiren']); } if (trim(strtolower($data['admin_dotfrcontactentitytype'])) == 'individual') { unset($data['admin_countrycode']); } } $result = internetbs_runCommand($commandUrl, $data); $errorMessage = internetbs_getLastError(); # If error, return the error message in the value below if ($result === false) { $values["error"] = internetbs_getConnectionErrorMessage($errorMessage); } else { if ($result['status'] == 'FAILURE') { $values["error"] = $result['message']; } } return $values; }
function InternetBS_Domain_Register($Settings, $DomainName, $DomainZone, $Years, $Ns1Name, $Ns1IP, $Ns2Name, $Ns2IP, $Ns3Name, $Ns3IP, $Ns4Name, $Ns4IP, $ContractID = '', $IsPrivateWhoIs, $PepsonID = 'Default', $Person = array()) { /****************************************************************************/ $__args_types = array('array', 'string', 'string', 'integer', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'boolean', 'string', 'string', 'array'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'utf8', 'IsLogging' => $Settings['Params']['IsLogging']); $username = $Settings['Login']; $password = $Settings['Password']; $tld = $DomainZone; $sld = $DomainName; $regperiod = $Years; $RegistrantFirstName = Translit($Person['Name']); $RegistrantLastName = Translit($Person['Lastname']); $RegistrantAddress1 = Translit($Person['pAddress']); $RegistrantCity = Translit($Person['pCity']); $RegistrantCountry = $Person['pCountry']; $RegistrantStateProvince = Translit($Person['pState']); $RegistrantPostalCode = $Person['pIndex']; $RegistrantEmailAddress = $Person['Email']; $RegistrantPhone = internetbs_reformatPhone($Person['Phone'], $Person['pCountry']); $domainName = $sld . '.' . $tld; $apiServerUrl = 'https://' . $Settings['Address'] . '/'; $commandUrl = $apiServerUrl . 'Domain/Create'; $nsar = array('ns1' => $Ns1Name, 'ns2' => $Ns2Name, 'ns3' => $Ns3Name, 'ns4' => $Ns4Name); $nslist = array(); for ($i = 1; $i <= 4; $i++) { if (isset($nsar["ns{$i}"])) { array_push($nslist, $nsar["ns{$i}"]); } } $data = array('apikey' => $username, 'password' => $password, 'domain' => $domainName, 'registrant_firstname' => $RegistrantFirstName, 'registrant_lastname' => $RegistrantLastName, 'registrant_street' => $RegistrantAddress1, 'registrant_city' => $RegistrantCity, 'registrant_countrycode' => $RegistrantCountry, 'registrant_postalcode' => $RegistrantPostalCode, 'registrant_email' => $RegistrantEmailAddress, 'registrant_phonenumber' => $RegistrantPhone, 'technical_firstname' => $RegistrantFirstName, 'technical_lastname' => $RegistrantLastName, 'technical_street' => $RegistrantAddress1, 'technical_city' => $RegistrantCity, 'technical_countrycode' => $RegistrantCountry, 'technical_postalcode' => $RegistrantPostalCode, 'technical_email' => $RegistrantEmailAddress, 'technical_phonenumber' => $RegistrantPhone, 'admin_firstname' => $RegistrantFirstName, 'admin_lastname' => $RegistrantLastName, 'admin_street' => $RegistrantAddress1, 'admin_city' => $RegistrantCity, 'admin_countrycode' => $RegistrantCountry, 'admin_postalcode' => $RegistrantPostalCode, 'admin_email' => $RegistrantEmailAddress, 'admin_phonenumber' => $RegistrantPhone, 'billing_firstname' => $RegistrantFirstName, 'billing_lastname' => $RegistrantLastName, 'billing_street' => $RegistrantAddress1, 'billing_city' => $RegistrantCity, 'billing_countrycode' => $RegistrantCountry, 'billing_postalcode' => $RegistrantPostalCode, 'billing_email' => $RegistrantEmailAddress, 'billing_phonenumber' => $RegistrantPhone); if (!empty($Person['CompanyName'])) { $data["Registrant_Organization"] = trim(Translit($Person['CompanyName'])); $data["technical_Organization"] = trim(Translit($Person['CompanyName'])); $data["admin_Organization"] = trim(Translit($Person['CompanyName'])); $data["billing_Organization"] = trim(Translit($Person['CompanyName'])); } if (count($nslist)) { $data['ns_list'] = trim(implode(',', $nslist), ","); } if (!$IsPrivateWhoIs) { $data["privateWhois"] = "FULL"; } else { $data["privateWhois"] = "DISABLE"; } $extarr = explode('.', $tld); $ext = array_pop($extarr); if ($tld == 'eu' || $tld == 'be' || $ext == 'uk') { $data['registrant_language'] = 'en'; } if ($tld == 'eu') { $europianLanguages = array("cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "hu", "it", "lt", "lv", "mt", "nl", "pl", "pt", "sk", "sl", "sv", "ro", "bg", "ga"); if (!in_array($data['registrant_language'], $europianLanguages)) { $data['registrant_language'] = 'en'; } $europianCountries = array('AT', 'AX', 'BE', 'BG', 'CZ', 'CY', 'DE', 'DK', 'ES', 'EE', 'FI', 'FR', 'GR', 'GB', 'GF', 'GI', 'GP', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'MQ', 'NL', 'PL', 'PT', 'RE', 'RO', 'SE', 'SK', 'SI'); if (!in_array($RegistrantCountry, $europianCountries)) { $RegistrantCountry = 'IT'; } $data['registrant_countrycode'] = $RegistrantCountry; } if ($tld == 'be') { if (!in_array($data['registrant_language'], array('en', 'fr', 'nl'))) { $data['registrant_language'] = 'en'; } if (!in_array($RegistrantCountry, array("AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BA", "BW", "BV", "BR", "IO", "VG", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CK", "CR", "HR", "CU", "CY", "CZ", "CD", "DK", "DJ", "DM", "DO", "TL", "EC", "EG", "SV", "GQ", "ER", "EE", "ET", "FK", "FO", "FM", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GN", "GW", "GY", "HT", "HM", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "CI", "JM", "JP", "JO", "KZ", "KE", "KI", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "AN", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "KP", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "SH", "KN", "LC", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "GS", "KR", "ES", "LK", "SD", "SR", "SJ", "SZ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "VI", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VA", "VE", "VN", "WF", "EH", "YE", "ZM", "ZW"))) { $RegistrantCountry = 'IT'; } $data['registrant_countrycode'] = $RegistrantCountry; } if ($tld == 'us') { $data['registrant_uspurpose'] = 'P3'; $data['registrant_usnexuscategory'] = 'C31'; $data['registrant_usnexuscountry'] = $Person['pCountry']; } if ($ext == 'uk') { $data['registrant_dotUKOrgType'] = "FOTHER"; $data['registrant_dotUKLocality'] = $RegistrantCountry; } if ($tld == 'asia') { return new gException('WRONG_ZONE_NAME', 'Указанная зона не поддерживается в автоматическом режиме'); } if (in_array($ext, array('fr', 're', 'pm', 'tf', 'wf', 'yt'))) { return new gException('WRONG_ZONE_NAME', 'Указанная зона не поддерживается в автоматическом режиме'); } if ($tld == 'tel') { $data['telHostingAccount'] = md5($RegistrantLastName . $RegistrantFirstName . time() . rand(0, 99999)); $data['telHostingPassword'] = '******' . rand(0, 99999); } if ($tld == 'it') { return new gException('WRONG_ZONE_NAME', 'Указанная зона не поддерживается в автоматическом режиме'); } if (isset($Years) && $regperiod > 0) { $data['period'] = $regperiod . "Y"; } $Result = HTTP_Send($commandUrl, $HTTP, array(), $data); if (Is_Error($Result)) { return ERROR | @Trigger_Error('[InternetBS_Domain_Register]:не удалось выполнить запрос к серверу'); } #----------------------------------------------------------------------------- $Result = Trim($Result['Body']); #----------------------------------------------------------------------------- $Result = internetbs_parseResult($Result); #----------------------------------------------------------------------------- #Debug(print_r($data, true)); #Debug(print_r($Result, true)); if (isset($Result['product_0_status'])) { if ($Result['product_0_status'] == 'SUCCESS') { return array('TicketID' => $domainName); } } else { if ($Result['status'] == 'FAILURE') { return new gException('REGISTRATOR_ERROR', 'Регистратор вернул ошибку'); } } return new gException('WRONG_ANSWER', $Result); }