PDA

View Full Version : Get content of a site


LearingJS
02-08-2005, 07:01 AM
Hi,
I got a little problem with a JavaScript. I'm trying to build a script that will get to content from another site. I have a domain whois search script in PHP, and I want to use JavaScript to get the result fromt the PHP site.

The user type a domain in a textbox (no toplevel) and press search. Then I what I'm trying to build is a script that displays:
domain.com searching...
domain.net searching...
doman.ord searching...
And at the same time run a script that calls the following pages, and fetch the content:
domain.php?domain=domain&tld=com
domain.php?domain=domain&tld=net
domain.php?domain=domain&tld=org
As soon as it gets the result back from one of these pages, eg. the .net search, it will update domain.net searching.... to domain.net - not available. The text "not available" is the text that the PHP script will show if the domain is no available. As the results from the other searches is ready, I want them as well replacin "searching..." for the correct domain.

One important thing is that the first domain that answers is the first to get updated. If .net answers fist, the .net searching text will first be replaced. A whois search like this can take a couple of seconds.

I'm a PHP programmer, and don't know enough about javascript - but I have been trying to build this script, but it will just not work. I use the window.ActiveXObject and xmlDoc.open functions (not sure this is the best way) to get the content from the PHP script, but although I try to fetch all the domain info, it only fetch the last domain.

Does anyone have any suggestions?

Thanks :)

LearingJS
02-09-2005, 07:02 AM
Okay, if nobody got a solution to that, what is the best way to fetch/grab the content of another site?

Philip M
02-09-2005, 06:40 PM
I expect no-one has posted an answer as what you desire cannot be done with JavaScript. I wonder if you are confusing JavaScript with Java, which
is a completely different language.