hasTable('switchepp_login_details')) { try { Capsule::schema()->create('switchepp_login_details', function ($table) { $table->increments('id'); $table->string('username'); $table->string('password'); $table->string('epp_url'); $table->string('port'); $table->string('passphrase'); } ); } catch (\Exception $e) { logActivity("Unable to create switchepp_login_details: {$e->getMessage()}"); } } if (Capsule::Schema()->hasTable('switchepp_login_details')) { if (!Capsule::Schema()->hasColumn('switchepp_login_details', 'passphrase')) $table->string('passphrase'); } /* * *************************Create table for store user record****************************** */ if (!Capsule::Schema()->hasTable('switchepp_contact_details')) { try { Capsule::schema()->create( 'switchepp_contact_details', function ($table) { $table->increments('id'); $table->string('type'); $table->string('contact_id'); } ); } catch (\Exception $e) { logActivity("Unable to create switchepp_contact_details: {$e->getMessage()}"); } } /* * **********************************save poll msgid******************************************** */ if (!Capsule::Schema()->hasTable('switchepp_store_msgid')) { try { Capsule::schema()->create( 'switchepp_store_msgid', function ($table) { $table->increments('id'); $table->string('msgid'); } ); } catch (\Exception $e) { logActivity("Unable to create switchepp_store_msgid: {$e->getMessage()}"); } } /* * ****************************create table to store country name*********************************** */ if (!Capsule::Schema()->hasTable('switchepp_manage_country')) { try { Capsule::schema()->create( 'switchepp_manage_country', function ($table) { $table->increments('id'); $table->string('country'); $table->string('country_key'); } ); } catch (\Exception $e) { logActivity("Unable to create switchepp_manage_country: {$e->getMessage()}"); } } $contrs = "Afghanistan__AF,Aland Islands__AX,Albania__AL,Algeria__DZ,American Samoa__AS,Andorra__AD,Angola__AO,Anguilla__AI,Antarctica__AQ,Antigua And Barbuda__AG,Argentina__AR,Armenia__AM,Aruba__AW,Australia__AU,Austria__AT,Azerbaijan__AZ,Bahamas__BS,Bahrain__BH,Bangladesh__BD,Barbados__BB,Belarus__BY,Belgium__BE,Belize__BZ,Benin__BJ,Bermuda__BM,Bhutan__BT,Bolivia__BO,Bosnia And Herzegovina__BA,Botswana__BW,Bouvet Island__BV,Brazil__BR,British Indian Ocean Territory__IO,Brunei Darussalam__BN,Bulgaria__BG,Burkina Faso__BF,Burundi__BI,Cambodia__KH,Cameroon__CM,Canada__CA,Cape Verde__CV,Cayman Islands__KY,Central African Republic__CF,Chad__TD,Chile__CL,China__CN,Christmas Island__CX,Cocos (Keeling) Islands__CC,Colombia__CO,Comoros__KM,Congo__CG,Congo__CD,Cook Islands__CK,Costa Rica__CR,Croatia__HR,Cuba__CU,Curacao__CW,Cyprus__CY,Czech Republic__CZ,Denmark__DK,Djibouti__DJ,Dominica__DM,Dominican Republic__DO,Ecuador__EC,Egypt__EG,El Salvador__SV,Equatorial Guinea__GQ,Eritrea__ER,Estonia__EE,Ethiopia__ET,Falkland Islands (Malvinas)__FK,Faroe Islands__FO,Fiji__FJ,Finland__FI,France__FR,French Guiana__GF,French Polynesia__PF,French Southern Territories__TF,Gabon__GA,Gambia__GM,Georgia__GE,Germany__DE,Ghana__GH,Gibraltar__GI,Greece__GR,Greenland__GL,Grenada__GD,Guadeloupe__GP,Guam__GU,Guatemala__GT,Guernsey__GG,Guinea__GN,Guinea-Bissau__GW,Guyana__GY,Haiti__HT,Heard Island & Mcdonald Islands__HM,Holy See (Vatican City State)__VA,Honduras__HN,Hong Kong__HK,Hungary__HU,Iceland__IS,India__IN,Indonesia__ID,Iran__IR,Iraq__IQ,Ireland__IE,Isle Of Man__IM,Israel__IL,Italy__IT,Jamaica__JM,Japan__JP,Jersey__JE,Jordan__JO,Kazakhstan__KZ,Kenya__KE,Kiribati__KI,Korea__KR,Kuwait__KW,Kyrgyzstan__KG,Latvia__LV,Lebanon__LB,Lesotho__LS,Liberia__LR,Libyan Arab Jamahiriya__LY,Liechtenstein__LI,Lithuania__LT,Luxembourg__LU,Macao__MO,Macedonia__MK,Madagascar__MG,Malawi__MW,Malaysia__MY,Maldives__MV,Mali__ML,Malta__MT,Marshall Islands__MH,Martinique__MQ,Mauritania__MR,Mauritius__MU,Mayotte__YT,Mexico__MX,Micronesia__FM,Moldova__MD,Monaco__MC,Mongolia__MN,Montenegro__ME,Montserrat__MS,Morocco__MA,Mozambique__MZ,Myanmar__MM,Namibia__NA,Nauru__NR,Nepal__NP,Netherlands__NL,Netherlands Antilles__AN,New Caledonia__NC,New Zealand__NZ,Nicaragua__NI,Niger__NE,Nigeria__NG,Niue__NU,Norfolk Island__NF,Northern Mariana Islands__MP,Norway__NO,Oman__OM,Pakistan__PK,Palau__PW,Palestinian Territory__PS,Panama__PA,Papua New Guinea__PG,Paraguay__PY,Peru__PE,Philippines__PH,Pitcairn__PN,Poland__PL,Portugal__PT,Puerto Rico__PR,Qatar__QA,Reunion__RE,Romania__RO,Russian Federation__RU,Rwanda__RW,Saint Barthelemy__BL,Saint Helena__SH,Saint Kitts And Nevis__KN,Saint Lucia__LC,Saint Martin__MF,Saint Pierre And Miquelon__PM,Saint Vincent And Grenadines__VC,Samoa__WS,San Marino__SM,Sao Tome And Principe__ST,Saudi Arabia__SA,Senegal__SN,Serbia__RS,Seychelles__SC,Sierra Leone__SL,Singapore__SG,Slovakia__SK,Slovenia__SI,Solomon Islands__SB,Somalia__SO,South Africa__ZA,South Georgia And Sandwich Isl.__GS,Spain__ES,Sri Lanka__LK,Sudan__SD,Suriname__SR,Svalbard And Jan Mayen__SJ,Swaziland__SZ,Sweden__SE,Switzerland__CH,Syrian Arab Republic__SY,Taiwan__TW,Tajikistan__TJ,Tanzania__TZ,Thailand__TH,Timor-Leste__TL,Togo__TG,Tokelau__TK,Tonga__TO,Trinidad And Tobago__TT,Tunisia__TN,Turkey__TR,Turkmenistan__TM,Turks And Caicos Islands__TC,Tuvalu__TV,Uganda__UG,Ukraine__UA,United Arab Emirates__AE,United Kingdom__GB,United States__US,United States Outlying Islands__UM,Uruguay__UY,Uzbekistan__UZ,Vanuatu__VU,Venezuela__VE,Viet Nam__VN,Virgin Islands__VG,Virgin Islands.__VI,Wallis And Futuna__WF,Western Sahara__EH,Yemen__YE,Zambia__ZM,Zimbabwe__ZW"; $contrs01 = explode(',', $contrs); foreach ($contrs01 as $contrs02) { $contrs03 = explode('__', $contrs02); try { Capsule::table('switchepp_manage_country')->insert(['country' => trim($contrs03[0]), 'country_key' => $contrs03[1]]); } catch (Exception $ex) { logActivity("Unable to insert data switchepp_manage_country: {$ex->getMessage()}"); } } /* * **************************Save login detail*************************************** */ if (isset($_POST['save']) && $_POST['save'] == 'Save To Make Connection') { $data = Capsule::table('switchepp_login_details')->first(); $data = (array) $data; $rows = Capsule::table('switchepp_login_details')->count(); $dataArr = array( 'username' => (empty($_POST['login_id'])) ? '' : $_POST['login_id'], 'password' => (empty($_POST['password'])) ? '' : $_POST['password'], 'epp_url' => (empty($_POST['epp_url'])) ? '' : $_POST['epp_url'], 'port' => (empty($_POST['port'])) ? '' : $_POST['port'], 'passphrase' => (empty($_POST['passphrase'])) ? '' : $_POST['passphrase'], ); if ($rows > 0) { try { Capsule::table('switchepp_login_details')->where('id', $data['id'])->update($dataArr); } catch (Exception $ex) { logActivity("Unable to update data switchepp_login_details: {$ex->getMessage()}"); } } else { try { Capsule::table('switchepp_login_details')->insert($dataArr); } catch (Exception $ex) { logActivity("Unable to insert data switchepp_login_details: {$ex->getMessage()}"); } } } $rows = Capsule::table('switchepp_login_details')->count(); $logindata = Capsule::table('switchepp_login_details')->first(); $logindata = $data = (array) $logindata; $params = array('eppurl' => $logindata['epp_url'], 'eppport' => $logindata['port'], 'registrar_id' => $logindata['username'], 'registrar_password' => $logindata['password'], 'passphrase' => $logindata['passphrase']); $error = $msg = ''; if (!empty($_POST['eppCommand'])) { /* * ******************************* Hello command ************************************* */ if ($_POST['eppCommand'] == 'hello') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $request = ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response = simplexml_load_string($request_xml); /* * ******************************* Login Command ************************************* */ } else if ($_POST['eppCommand'] == 'login') { #login command $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } else { $request = ' ' . $_POST['username'] . ' ' . $_POST['old_pw'] . ' ' . $_POST['new_pw'] . ' 1.0 en urn:ietf:params:xml:ns:domain-1.0 urn:ietf:params:xml:ns:contact-1.0 urn:ietf:params:xml:ns:host-1.0 ' . rand(9999999, 100000) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } } /* * ******************************* Logout command ************************************* */ } elseif ($_POST['eppCommand'] == 'logout') { #Logout command $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $data['username'] . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Poll command ************************************* */ } elseif ($_POST['eppCommand'] == 'poll') { #Poll command $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' POLL-' . rand(10000, 99999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $poll_xml_code = simplexml_load_string($request_xml); $msgid = $poll_xml_code->response->msgQ->attributes()->id[0]; $row = Capsule::table('switchepp_store_msgid')->count(); $id = Capsule::table('switchepp_store_msgid')->first(); $id = (array) $id; if ($row > 0) { try { Capsule::table('switchepp_store_msgid')->where('id', $id['id'])->update(['msgid' => $msgid]); } catch (Exception $ex) { logActivity("Unable to update data switchepp_store_msgid: {$ex->getMessage()}"); } } else { try { Capsule::table('switchepp_store_msgid')->insert(['msgid' => $msgid]); } catch (Exception $ex) { logActivity("Unable to insert data switchepp_store_msgid: {$ex->getMessage()}"); } } $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Transfer Domain1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'transfer_domain1') { # Transfer command $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['trnsfr_domain']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ' . $_POST['trnsfr_pw'] . ' TRANS-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Aknowledge Message command ************************************* */ } elseif ($_POST['eppCommand'] == 'acknoledge_msg') { #Poll Acknowledge message $id = Capsule::table('switchepp_store_msgid')->first(); $id = (array) $id; $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' POLLCF-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Check Contact1 Command ************************************* */ } elseif ($_POST['eppCommand'] == 'check_contact1') { #check contact 1 $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['cont1'] . ' ' . $_POST['cont2'] . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create Contact1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_con1') { #create contact 1 $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['contact_id1'] . ' ' . $_POST['cfullname'] . ' ' . $_POST['ccompanyname'] . ' ' . $_POST['caddress1'] . ' ' . $_POST['caddress2'] . ' ' . $_POST['ccity'] . ' ' . $_POST['cpostcode'] . ' ' . $_POST['ccountry'] . ' ' . $_POST['cphone'] . ' ' . $_POST['cemail'] . ' Con-' . time() . ' admin-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_contact = simplexml_load_string($request_xml); $success = $response_contact->response->result->attributes()->code[0]; $admin_id = $response_contact->response->resData->children('contact', true)->creData->id; if ($success == '1000') { $rows = Capsule::table('switchepp_contact_details')->where('type', 'admin')->count(); if ($rows > 0) { try { Capsule::table('switchepp_contact_details')->where('type', 'admin')->update(['contact_id' => $admin_id]); } catch (Exception $ex) { logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}"); } } else { try { Capsule::table('switchepp_contact_details')->insert(['contact_id' => $admin_id]); } catch (Exception $ex) { logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}"); } } } $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create NS1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_ns1') { #create hostname 1 $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['host_name'] . ' ' . $_POST['ip'] . ' ' . rand(9999999, 100000) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); //if($success == '1000'){ //$query = mysql_query("SELECT * FROM `switchepp_store_host`"); //} $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Domain Info 1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'domain_info') { #domain info 1 $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['domaininfo'] . ' DOMAININFO-' . rand(100, 999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Info Tech Contact command ************************************* */ } elseif ($_POST['eppCommand'] == 'info_tech_contact') { #Tech contact info $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first(); $result = (array) $data; $request = ' ' . $_POST['cont_info'] . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Update Domain1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'update_domain_1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); # Generate XML for nameservers if ($nameserver1 = $_POST["ns1"]) { $add_hosts = ' ' . $nameserver1 . ' '; } if ($nameserver2 = $_POST["ns2"]) { $add_hosts .= ' ' . $nameserver2 . ' '; } if ($nameserver3 = $_POST["ns3"]) { $add_hosts .= ' ' . $nameserver3 . ' '; } if ($nameserver4 = $_POST["ns4"]) { $add_hosts .= ' ' . $nameserver4 . ' '; } if ($nameserver5 = $_POST["ns5"]) { $add_hosts .= ' ' . $nameserver5 . ' '; } $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first(); $data = (array) $data; $IDN = new IDNA(); $input = $_POST['up_domain_name']; $domainname = $IDN->encode($input); $add_input = $_POST['up_add_ns']; $add_ns = $IDN->encode($add_input); $rem_input = $_POST['up_rem_ns']; $rem_ns = $IDN->encode($rem_input); $dnssec = ''; if (isset($_POST['up_d_dnssec']) && $_POST['up_d_dnssec'] == '1') { $dnssec = ' ' . substr(time(), 0, 5) . ' 3 1 ' . strtoupper(bin2hex(uniqid())) . ' '; } $request = ' ' . $domainname . ' ' . $add_ns . ' ' . $_POST['up_contact_id'] . ' ' . $rem_ns . ' ' . $_POST['up_contact_id'] . ' ' . $dnssec . ' clientref-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Update Domain1 contact command ************************************* */ } elseif ($_POST['eppCommand'] == 'update_domain_1_contact') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $IDN = new IDNA(); $xml1 = switchepp_loggedinepp($client, $params); $input = $_POST['c_up_domain_name']; error_log("INPUT: \"" . $input . "\" POST: \"" . $_POST['c_up_domain_name'] . "\""); $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ' . $_POST['c_up_contact_id'] . ' clientref-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create Contact 2 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_con2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['contact_id2'] . ' ' . $_POST['cfullname2'] . ' ' . $_POST['ccompanyname2'] . ' ' . $_POST['caddress12'] . ' ' . $_POST['caddress22'] . ' ' . $_POST['ccity2'] . ' ' . $_POST['cpostcode2'] . ' ' . $_POST['ccountry2'] . ' ' . $_POST['cphone2'] . ' ' . $_POST['cemail2'] . ' Con-' . time() . ' admin-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_contact = simplexml_load_string($request_xml); $success = $response_contact->response->result->attributes()->code[0]; $tech_id = $response_contact->response->resData->children('contact', true)->creData->id; if ($success == '1000') { $rows = Capsule::table('switchepp_contact_details')->where('type', 'tech')->count(); if ($rows > 0) { try { Capsule::table('switchepp_contact_details')->where('type', 'tech')->update(['contact_id' => $tech_id]); } catch (Exception $ex) { logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}"); } } else { try { Capsule::table('switchepp_contact_details')->insert(['contact_id' => $tech_id]); } catch (Exception $ex) { logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}"); } } } $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Domain 1 Delete command ************************************* */ } elseif ($_POST['eppCommand'] == 'domain_delete1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domaininfo']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create Domain1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_domain_1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first(); $data = (array) $data; $data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first(); $data1 = (array) $data1; //******************* NameServer ************* if ($_POST['ns1']) { $ns .= '' . $_POST['ns1'] . ''; } if ($_POST['ns2']) { $ns .= '' . $_POST['ns2'] . ''; } if ($_POST['ns3']) { $ns .= '' . $_POST['ns3'] . ''; } if ($_POST['ns4']) { $ns .= '' . $_POST['ns4'] . ''; } if ($ns) { $nsnameserver = ' ' . $ns . ' '; } $dnssec = ''; if (isset($_POST['cr_d1_dnssec']) && $_POST['cr_d1_dnssec'] == '1') { $dnssec = ' ' . substr(time(), 0, 5) . ' 3 1 ' . strtoupper(bin2hex(uniqid())) . ' '; } $IDN = new IDNA(); $input = $_POST['domain_name']; $domainname = $IDN->encode($input); //domian create command $request = ' ' . $domainname . ' ' . $nsnameserver . ' ' . $_POST['reg_con_id'] . ' switchpwd' . uniqid() . ' ' . $dnssec . ' ' . rand(9999999, 100000) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Contact Delete 1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'contact_delete_1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first(); $data = (array) $data; $request = ' ' . $_POST['del_contact_id'] . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Delete NS1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'delete_ns_1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['nameserver']; $nameserver = $IDN->encode($input); $request = ' ' . $nameserver . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Check Domain 2 command ************************************* */ } elseif ($_POST['eppCommand'] == 'check_domain_2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domain_name2']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create Domain 2 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_domain_2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first(); $data = (array) $data; $data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first(); $data1 = (array) $data1; //*******************NameServer*************# if ($_POST['ns1']) { $ns .= '' . $_POST['ns1'] . ''; } if ($_POST['ns2']) { $ns .= '' . $_POST['ns2'] . ''; } if ($_POST['ns3']) { $ns .= '' . $_POST['ns3'] . ''; } if ($_POST['ns4']) { $ns .= '' . $_POST['ns4'] . ''; } if ($ns) { $nsnameserver = ' ' . $ns . ' '; } $IDN = new IDNA(); $input = $_POST['domain_name']; $domainname = $IDN->encode($input); //domian create command $request = ' ' . $domainname . ' ' . $nsnameserver . ' ' . $_POST['tech_con_id'] . ' switchpwd' . uniqid() . ' ' . rand(9999999, 100000) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Create NS2 command ************************************* */ } elseif ($_POST['eppCommand'] == 'create_ns2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $request = ' ' . $_POST['host_name'] . ' ' . $_POST['ip'] . ' ' . rand(9999999, 100000) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Update Domain 1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'update_domain1w_2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domain']; $domainname = $IDN->encode($input); $input1 = $_POST['upd_nameserver']; $nameserver = $IDN->encode($input1); $request = ' ' . $domainname . ' ' . $nameserver . ' Test3 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Update Contact 2 command ************************************* */ } elseif ($_POST['eppCommand'] == 'update_con_2') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); //' . $data['contact_id'] . ' $data = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first(); $data = (array) $data; $request = ' ' . $_POST['contact_id'] . ' ' . $_POST['cname'] . ' ' . $_POST['add1'] . ' ' . $_POST['add2'] . ' ' . $_POST['up_city'] . ' ' . $_POST['up_city'] . ' ' . $_POST['up_city'] . ' ' . $_POST['up_country'] . ' ' . $_POST['up_phone'] . ' ' . $_POST['email'] . ' con-' . time() . ' clientref-' . rand(1000, 9999) . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Delete Domain 1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'del_domain1') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domaininfo']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ABC-12345 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Restore Domain 1 command ************************************* */ } elseif ($_POST['eppCommand'] == 'restore_domain_1') { error_log("RESTORE DOMAIN 1"); $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } error_log("PARAMS: " . print_r($params,true)); $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domain_name1']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } /* * ******************************* Update Domain Auth command ************************************* */ } elseif ($_POST['eppCommand'] == 'update_domain_auth') { $client = switchepp_clientloginepp($params); #Epp Connection if (is_array($client)) { $error = $client['msg']; } $xml1 = switchepp_loggedinepp($client, $params); $IDN = new IDNA(); $input = $_POST['domain_update']; $domainname = $IDN->encode($input); $request = ' ' . $domainname . ' ' . $_POST['auth'] . ' Test3 '; $request_xml = $client->request($request); $response_xml = htmlentities($request_xml); $response_chnge = simplexml_load_string($request_xml); $success = $response_chnge->response->result->attributes()->code[0]; if ($success == '1000') { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } else { foreach ($response_chnge->response->result as $resp) { $msg = $resp->msg; //for whmcs } } } } function switchepp_clientloginepp($params) { try { $certFile = __DIR__ . '/../cert/cert.pem'; $client = new Net_EPP_Client(); $use_ssl = true; if (file_exists($certFile)) { $context = stream_context_create(); stream_context_set_option($context, 'ssl', 'verify_peer', false); stream_context_set_option($context, 'ssl', 'allow_self_signed', true); stream_context_set_option($context, 'ssl', 'local_cert', $certFile); stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']); $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server"); } else { $context = false; $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server"); } } catch (Exception $e) { $port = $params['eppport']; $client = array("error" => 'true', 'msg' => "Connection Error: " . $e->getMessage()); } return $client; return $client; } function switchepp_loggedinepp($client, $params) { if (is_array($client)) { $error = $client['msg']; return $error; } if ($params['eppurl'] != '' && $params['eppport'] != '' && $params['registrar_password'] != '' && $params['registrar_id'] != '') { $request = ' ' . $params['registrar_id'] . ' ' . $params['registrar_password'] . ' 1.0 en urn:ietf:params:xml:ns:domain-1.0 urn:ietf:params:xml:ns:contact-1.0 urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:rgp-1.0 urn:ietf:params:xml:ns:changePoll-1.0 https://www.nic.ch/epp/balance-1.0 ' . rand(9999999, 100000) . ' '; //error_log("switchepp_loggedinepp: " . $client . " | " . $params); $response = $client->request($request); return $response; } } function switchepp_domain_info($domain) { $IDN = new IDNA(); $input = $domain; $domainname = $IDN->encode($input); $xml = ' ' . $domainname . ' clientref-' . rand(100, 999) . ' '; return $xml; } ?> count(); $data = Capsule::table('switchepp_login_details')->first(); $data = (array) $data; ?>

Try our EPP Demonstrator:

Socket Url :
login Id :
Port :
Password :
0) { ?>

Select Command to execute

where('type', 'admin')->first(); $result = (array) $result; if ($result['contact_id'] != '') { $request_xml = ' ' . $result['contact_id'] . ' ABC-12345 '; $get_response_xml = $client->request($request_xml); $get_xml_data = simplexml_load_string($get_response_xml); $get_data = $get_xml_data->response->resData->children("contact", true)->infData; } } ?> 0) { ?>

Epp Request :

************************************************************************************

Epp Response :