I am using the below code for a whois. It currently works fine in ie but it is not working in FF. Any help appreciated. <?php error_reporting(7); set_time_limit(300); // Server List File $config['server_list'] = "servers.lst"; $domain = trim($_POST['domain']); $domain = strtolower($domain); if(substr($domain,0,7) == "http://") { $domain = str_replace("http://","",$domain); } if(substr($domain,0,4) == "www.") { $domain = str_replace("www.","",$domain); } function whois_request($server, $query) { $data = ""; if(!$fp = @fsockopen($server, 43)) { Return false; } else { fputs($fp, $query . "\r\n"); while (!feof($fp)) { $data .= fread($fp, 1000); } fclose($fp); } return nl2br($data); } function get_server() { global $config,$domain; $serverarray = file($config['server_list']); $i = 0; foreach($serverarray as $key=>$val) { if(substr($val,0,1) != "#") { $server_p = explode("|",$val); $server[$i]['tld'] = $server_p[0]; $server[$i]['server'] = $server_p[1]; $server[$i]['avail'] = $server_p[2]; $server[$i]['infoserver'] = $server_p[3]; $server[$i]['backserver'] = $server_p[4]; $server[$i]['info'] = $server_p[5]; } $i++; } $domain_c = explode(".",$domain); $partnum = count($domain_c); $last_part_1 = $domain_c[$partnum-1]; $last_part_2 = $domain_c[$partnum-2]; foreach($server as $key=>$val) { if($val['tld'] == $last_part_2.".".$last_part_1) { Return $val; } elseif($val['tld'] == $last_part_1) { Return $val; } } Return false; } function startwhois() { global $domain; if(!$server = get_server()) { die("æ— æ³•æŸ¥è¯¢æ¤ç±»åž‹çš„域å"); } $result1 = whois_request($server['server'], $domain); $result2 = whois_request($server['infoserver'], $domain); if(!$result1 && !$result2) { echo "æ— æ³•è¿žæŽ¥æœåС噍"; die(); } else { $result = $result1."<br />".$result2; echo $result; } } if(isset($_GET['action']) && trim($_GET['action']) == "do") { startwhois(); die(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Whois</title> <link href="../images/global.css" rel="stylesheet" type="text/css" /> <script src="../images/global.js" type="text/javascript"></script> <SCRIPT type="text/javascript"> <!-- var xmlHttp; function creatXMLHttpRequest() { if(window.ActiveXObject) { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); } else if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } } function startRequest() { var queryString; var domain = document.getElementById('domain').value; queryString = "domain=" + domain; creatXMLHttpRequest(); xmlHttp.open("POST","?action=do","true"); xmlHttp.onreadystatechange = handleStateChange; xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;"); xmlHttp.send(queryString); } function handleStateChange() { if(xmlHttp.readyState == 1) { document.getElementById('result').style.cssText = ""; document.getElementById('result').innerText = "Loading..."; } if(xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { document.getElementById('result').style.cssText = ""; var allcon = xmlHttp.responseText; document.getElementById('result').innerHTML = allcon; } } } //--> </SCRIPT> </head> <body> <div style="margin-top:20px; margin-bottom:12px; text-align:center;"> <div class="t"><a href="http://xn--h6qv61aktwxux.com"><img src="../images/logo.png" alt="Whois" border="0" /></a></div> <div class="t f14"> <div> <a href="http://xn--h6qv61aktwxux.com">IP/域å</a> <a href="../alexa/">Alexa</a> <a href="../sfz/">身份è¯</a> <a href="../sj/">手机</a> <a href="../gr/">收录</a> Whois <a href="../yz/">邮编区å·</a> </div> </div> </div> <center> <div class="c"> <div> <input name="domain" type="text" size="36" maxlength="100" id="url" /> <input type="button" name="button" value="Whois" id="sub" onclick="startRequest();" /> </div> <div id="result" style="display:none"></div> </div> </center> <img src="images/loading.gif" width="0" height="0" /> <?php include "../footer.php"; ?> Code (markup):
You need to be more specific... We dont even know how it's supposed to look. Also, AJAX isn't a PHP function so it should probably go in the webdesign forum.
I'm not sure if it is ajax or php. The code is php so i posted it here. The problem is the result: <div id="result" style="display:none"></div> Code (markup): displays fine when searching the whois on internet explorer. on firefox however the result does not display. seeing as i am a coder i do not know more specifics, all code is in one file and that has been posted.
PHP code is server specific - not browser specific. If you're having problems with it only working in one browser, it'll be a JS/HTML issue. Dan
Change your function creatXMLHttpRequest function to the code below. We are going to javascript now. function creatXMLHttpRequest(){ try { xmlHttp = new XMLHttpRequest(); }catch(e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlHttp = false; }//catch }//catch }//catch }//end function creatXMLHttpRequest PHP: