} $ret = array(); #$info = get_whois_info($domain); $query = new Whois($domain); $query->whois_query(); $ret['Ret'] = 0; $ret['RetMsg'] = ""; $ret['BeginDate'] = get_begintime($query); $ret['EndDate'] = get_endtime($query); if ($ret['BeginDate'] == '未收录' && $ret['EndDate'] == '未收录') { $ret['Ret'] = 1; $ret['RetMsg'] = "该域名暂无相关信息<br/>请检查域名填写格式是否正确<br/>(例:不要携带如 ‘www’ 等子域名)"; print_r(json_encode($ret)); return; } $ret['Updated'] = get_updatetime($query); $ret['Nameservers'] = get_nameserver($query); $beginday = $ret['BeginDate']; $endday = $ret['EndDate']; $beginday = str_replace('年', '-', $beginday); $beginday = str_replace('月', '-', $beginday); $endday = str_replace('年', '-', $endday); $endday = str_replace('月', '-', $endday); $beginday = get_mktime($beginday); $endday = get_mktime($endday); $now = time(); $LDays = round(($endday - $now) / 3600 / 24); $TDays = round(($endday - $beginday) / 3600 / 24); $ret['LeaveDays'] = $LDays; $ret['TotalDays'] = $TDays; $ret['StatusInfo'] = get_status($query);
return; } $ret = array(); $info = get_whois_info($domain); $code = $info['code']; $ret['RetMsg'] = $info['msg']; if ($code != '1000') { $ret['Ret'] = 1; print_r(json_encode($ret)); return; } else { $ret['Ret'] = 0; } $info = $info['module']; #$ret['Updated'] = $info['updatedDate']; $ret['Updated'] = get_updatetime($domain); $ret['Nameservers'] = $info['nameServers']; $ret['Nameservers'] = match_ns($ret['Nameservers']); $ret['BeginDate'] = $info['standardFormatCreationDate']; $ret['EndDate'] = $info['standardFormatExpirationDate']; $beginday = $info['standardFormatCreationDate']; $endday = $info['standardFormatExpirationDate']; $beginday = str_replace('年', '-', $beginday); $beginday = str_replace('月', '-', $beginday); $endday = str_replace('年', '-', $endday); $endday = str_replace('月', '-', $endday); $beginday = get_mktime($beginday); $endday = get_mktime($endday); $now = time(); $LDays = round(($endday - $now) / 3600 / 24); $TDays = round(($endday - $beginday) / 3600 / 24);