I need to lookup domains names from an XML file and then loop through each domain to see whether it exists or not..
Im using below approaches..
1.fsockopen() 2.checkdnsrr()
Number of records in XML file is around 120.Im using AJAX to get the results..
Results :
**1.with approach-1 -- it took 13-14 s on an average on localhost
2.with approach-1 -- it took 25-30 s on an average on live server
1.with approach-2 -- it took 6-8 s on an average on localhost
2.with approach-1 -- it took 19-22 s on an average on live server**
Why the difference with localhost and live server?? Because in both the cases i have a 2MBPS Machine to test from..
Also i would like to show the availability of each domain entry as soon as it is scanned rather than dumping whole results when ajax call returns..How am i supposed to achieve this??
Any help is appreciated
First of all, queries on localhost might be faster because the DNS results are cached already.
You should do these tests on a cache-clean machine, but it's always tricky to clean DNS cache entries. Or maybe your browser cache some results too. (See DNS Flusher)
About the AJAX requests, what you are looking for is asynchronous requests. AJAX works in both modes :
Checkout http://javascript.about.com/od/ajax/a/ajaxasyn.htm
In jQuery, you have a parameter
async: true
to achieve this.Good luck with your project.