Motlive Posted May 1, 2007 Share Posted May 1, 2007 Hi All, a newbie for you all to abuse I have been trying to get my head around this for a while and it just wont budge. i have a debian machine that runs: <?php $output = `/usr/bin/host -t ns $query`; $find [] = "Host $query not found: 3(NXDOMAIN)"; $find [] = "$query name server"; $replace [] = " Domain Not Found - Please make sure you've spelt it correctly"; $replace [] = ""; $output = str_replace($find, $replace, strtolower( trim( $output ) ) ); if (preg_match("^[a-z0-9\:\.\-]+$^", "$output $query")) { echo "Name Servers:<pre>$output</pre>"; } elseif ($domain == ""){ echo ""; } else { echo "You have entered an invalid domain name, do not enter 'http://' or 'www.'"; } ?> Now i have moved over to a Windows Server running IIS instead of Apache and I dont know how to make the above work in that enviroment :S any guidance would be much appreciated. Quote Link to comment Share on other sites More sharing options...
neel_basu Posted May 1, 2007 Share Posted May 1, 2007 Why not you use exec() Quote Link to comment Share on other sites More sharing options...
neel_basu Posted May 1, 2007 Share Posted May 1, 2007 And what actually you wanna Do ?? Quote Link to comment Share on other sites More sharing options...
Motlive Posted May 1, 2007 Author Share Posted May 1, 2007 I dont understand where i am meant to point the exec() function towards. I have a page which you enter in a domain and it will give you info on its name servers, MX records A records and the WHOIS. so simple DNS lookups really. Quote Link to comment Share on other sites More sharing options...
Motlive Posted May 1, 2007 Author Share Posted May 1, 2007 <?php $output = `/usr/bin/host -t ns $query`; $find [] = "Host $query not found: 3(NXDOMAIN)"; $find [] = "$query name server"; $...... and so on bugger.. sorry i missed out the command on my first post: Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted May 1, 2007 Share Posted May 1, 2007 Exec is never a good idea to use, and it's better to be avoided for security reasons. For your issue, you may want to look around PHP.net and see if there are any bugs related to your specific system. Looking at the code I don't see anything off hand that might be messing it up, it looks fine, maybe there is a type of bug with one of the functions you are using that is only a bug on that specific system, you can check into it over at php.net by going through there list of bug's, or running a few google searches on "php problems on (insert operating system here)" Based on your last post, if you are wanting to do DNS lookups. http://www.google.com/search?source=ig&hl=en&q=DNS+lookup+API+with+php&btnG=Google+Search You will find a lot of stuff there, that will help you find out everything you need, on making it work. Don't use the exec function, I am warning you before it's too late, especially if you are using it with user input, you will end up finding out why I advised you not to if you try and use it. Quote Link to comment Share on other sites More sharing options...
trq Posted May 1, 2007 Share Posted May 1, 2007 This command... /usr/bin/host -t ns $query Is never going to hold up in windows, it is a *nix command. I'm not sure whats available on windows, but you will need to find an equivelent to the host command, I'm just not sure one would exist. Quote Link to comment Share on other sites More sharing options...
Motlive Posted May 1, 2007 Author Share Posted May 1, 2007 That seems to be the conclusion I am coming to as well.. bugger. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted May 1, 2007 Share Posted May 1, 2007 http://www.dbforums.com/archive/index.php/t-1059308.html This is all I could find, hopefully it helps it was as close as I could come to finding something helpful. Quote Link to comment Share on other sites More sharing options...
Motlive Posted May 1, 2007 Author Share Posted May 1, 2007 Many thanks for the help, think ill have to implement an ubuntu server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.