//西部数码API
$sys_api = "http://api.west263.com/api/";
$sys_user= "8888888";//西部数码的api账号
$sys_pass= "8888888";//西部数码的api密码
//西部数码返回的XML 转化为数组
function xmlarray($xml){
    $xmlfile = file_get_contents($xml);
    $ob= simplexml_load_string($xmlfile);
    $json  = json_encode($ob);
    $configData = json_decode($json, true);
    return $configData;
    }


//------------------------------------查询域名
//命令格式查询域名<CRLF>要用 "."\r\n"."   替换 切记!!!命令行最后也要加上 ."\r\n"."."."\r\n" 这里面有一个“.”
//$yuming需要查询的域名可用逗号添加如 123.com,456.com
$cmdstrng="domainname"."\r\n"."check"."\r\n"."entityname:domain-check"."\r\n"."domainname:".$yuming.""."\r\n"."suffix:".$str.""."\r\n"."."."\r\n";
$cmdstrng=mb_convert_encoding($cmdstrng,"gb2312","utf-8");
$md5sing=md5( $sys_user.$sys_pass .substr($cmdstrng,0,10));
$postdata=$sys_api."?userid=".$sys_user."&versig=".$md5sing."&strCmd=".urlencode($cmdstrng);
$return =xmlarray($postdata);
if($return['returncode']==200){//返回可用的域名
$keyi=explode(",",$return['info']['record']['allow']);//分割字符串返回域名数组
}
//不可以注册的域名
if(!empty($return['info']['record']['registered'])){
$bukeyi=explode(",",$return['info']['record']['registered']);
}



//---------------------------------注册域名
//对应的参数 太多了就不一一介绍了 我写的都是必须的参数
$cmdstrng="domainname"."\r\n"."add"."\r\n"."entityname:domain"."\r\n"."domainname:".$k['yuming'].""."\r\n"."dmtype:ENG"."\r\n"."term:".$k['nian'].""."\r\n"."dom_org:".$info['dom_org'].""."\r\n"."dom_fn:".$info['dom_fn'].""."\r\n"."dom_ln:".$info['dom_ln'].""."\r\n"."dom_adr1:".$info['dom_adr1'].""."\r\n"."dom_ct:".$info['dom_ct'].""."\r\n"."dom_st:".$info['dom_st'].""."\r\n"."dom_co:cn"."\r\n"."dom_pc:".$info['dom_pc'].""."\r\n"."dom_ph:".$info['dom_ph'].""."\r\n"."dom_fax:".$info['dom_fax'].""."\r\n"."dom_em:".$info['dom_em'].""."\r\n"."dom_org_m:".$info['dom_org_m'].""."\r\n"."dom_fn_m:".$info['dom_fn_m'].""."\r\n"."dom_ln_m:".$info['dom_ln_m'].""."\r\n"."dom_adr_m:".$info['dom_adr_m'].""."\r\n"."dom_ct_m:".$info['dom_ct_m'].""."\r\n"."dom_st_m:".$info['dom_st_m'].""."\r\n"."domainpwd:".$info['domainpwd'].""."\r\n"."ppricetemp:".$k['price'].""."\r\n"."."."\r\n";
    //echo $cmdstrng;die();
    $cmdstrng=mb_convert_encoding($cmdstrng,"gb2312","utf-8");
    $md5sing=md5( $sys_user.$sys_pass .substr($cmdstrng,0,10));
    $postdata=$sys_api."?userid=".$sys_user."&versig=".$md5sing."&strCmd=".urlencode($cmdstrng);
    $return =xmlarray($postdata);
    if($return['returncode']==200){//域名可以注册
    $times=time();
    $dao_times=strtotime("+".$k['nian']." year");//到期日期
    $sql="INSERT INTO `yuming`( `yuming`, `userid`, `dao_times`, `times`, `type`) VALUES ('".$k['yuming']."',".$dingda['userid'].",'".$dao_times."','".$times."',2)";
    //echo $sql;die();
    mysql_query($sql);
    }else{
        $sql="INSERT INTO `yuming`( `yuming`, `userid`, `dao_times`, `times`, `type`) VALUES ('".$k['yuming']."',".$dingda['userid'].",'".$dao_times."','".$times."',1)";
      mysql_query($sql);
      $wei.=$k['yuming'].",";
      
        }
    //print_r($return);die();
    }
//报告注册不了的域名
if($wei!=""){
    echo"<script type='text/javascript'>alert('".$wei."域名未注册成功,可联系管理员退款');</script>";
    echo"<script type='text/javascript'>window.location.href='../user.php'</script>";die();
}
echo"<script type='text/javascript'>alert('域名注册成功');</script>";
    echo"<script type='text/javascript'>window.location.href='../user.php'</script>";die();


//---------------------------------添加域名解析
//$jiexi['yuming']需要解析的域名其他参数为对应的值
$cmdstrng="dnsresolve"."\r\n"."add"."\r\n"."entityname:dnsrecord"."\r\n"."domain:".$jiexi['yuming'].""."\r\n"."rr:www"."\r\n"."value:".$_POST['zhi'].""."\r\n"."type:".$xi.""."\r\n"."ttl:".$_POST['ttl'].""."\r\n"."."."\r\n";
    $cmdstrng=mb_convert_encoding($cmdstrng,"gb2312","utf-8");
    $md5sing=md5( $sys_user.$sys_pass .substr($cmdstrng,0,10));
    $postdata=$sys_api."?userid=".$sys_user."&versig=".$md5sing."&strCmd=".urlencode($cmdstrng);
    $return =xmlarray($postdata);
    if($return['returncode']==200){//解析成功执行后续操作
    }


//---------------------------------删除域名解析
//$jiexi['yuming']需要解析的域名
//$xi['jiexi_id']解析后返回的id 很重啊哟
$xi=mysql_fetch_assoc(mysql_query("select * from jiexi where id='".$_POST['id']."'"));
    $cmdstrng="dnsresolve"."\r\n"."del"."\r\n"."entityname:dnsrecord"."\r\n"."domain:".$jiexi['yuming'].""."\r\n"."rr_id:".$xi['jiexi_id'].""."\r\n"."."."\r\n";
    $cmdstrng=mb_convert_encoding($cmdstrng,"gb2312","utf-8");
    $md5sing=md5( $sys_user.$sys_pass .substr($cmdstrng,0,10));
    $postdata=$sys_api."?userid=".$sys_user."&versig=".$md5sing."&strCmd=".urlencode($cmdstrng);
    $return =xmlarray($postdata);
    if($return['returncode']==200){
    }
Last modification:September 18th, 2019 at 08:15 pm
如果觉得我的文章对你有用,请随意赞赏