View Full Version : Grabbing a DOM for use with Google Maps
10-12-2005, 11:14 PM
I am messing around with Google Maps a little and the fundamental difficulty in building anything useful is extrapolating address information from another website. I would like to be able to use a form like yahoo yellow pages send it a zip code and get back a bunch of, say, banks in that zip code and parse the address out. Some things, very few, actually return data in the XML format, but how do you write a script that send a request to a website and then returns that request as a DOM object. I'll even take HTML and then I'll parse it out myself, but how do you do that.
I know it sounds fundamental, but I'm a real beginner in this, so if you can push me in the right direction I would appreciate it too. Thank you.
10-13-2005, 12:39 AM
You can use a client or serverside xmlhttp request, and "post" or "get" the form data to the specified url. If it's html data being returned in lieu of xml then you'll want to request the responseText of the xmlhttp object. It returns the html as a string, which is not navigable through the DOM, but I just added the string to a hidden div and then pulled out the nodes I wanted. It would be cool if there was some way to treat that string as you would when it was displayed by the browser so you wouldn't have to add unessary data to the page just to get the data you actually wanted displayed. Perhaps someone could help us both out. In any case here is a serverside example of what I'm reffering to:
This code is part of a client page that does a clientside request to this page which does a serverside request to an external url and then returns the results of the serverside request back to the client. Personally I think it's quite nifty. :p
10-13-2005, 05:55 AM
I'm hearing some people say that I can't use a client-side xmlhttp request to another URL from my URL do you know anything about that? I'll have to try it out, but I'm getting some disparate information.
10-14-2005, 01:43 AM
I think that's right, you can't do it clientside to a different domain, but if you do it clientside to your server and then out to the other domain from your server, it is a plausable workaround.
10-14-2005, 02:36 AM
I think I am starting to see. You need to have a client-side call to a server-side function say a PHP function or whatever which has to sit on the server I guess and then that php function can return the raw HTML at which point you can try to force it into a DOM or something.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.