Forum Moderators: open
I'm a total XML noob, but I have created a google map for one of my sites which gets the info from an XML file containg about 200 marker locations. This works fine and I'm happy with it.
However, while this information is great to show to consumers, there are a number of competitors out there who would love to get their hands on this data and copy it for use on their own sites. Simply having an XML file stored on my server, and anyone being able to see and download the file feeding the maps, clearly raises a problem.
Is there any way of password protecting an XML file, or somehow encrypting it or something? I just need the file to feed the google map, but not be so easily downloadable as it is right now.
Here's a snippet from my gmap page, if it helps at all
var request = GXmlHttp.create();
request.open("GET", "MY-XML-FILE.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
var markers = xmlDoc.documentElement.getElementsByTagName("marker");
This isn't an XML issue, as much as it is a Google Maps API or PHP server side issue. I use GM quite a bit myself, and can pretty much understand the problem.
As with any file, it is quite possible to lock down an XML file at the server, and prevent its being read.
If you are generating the markers as JSON objects, then you can easily write your PHP to get the XML with a private key of some kind, so the original XML is not accessible. However, you still need to create some kind of world-readable data to feed to the map API.
The best answer is probably something like:
Server 1: XML file (encrypted or protected)
¦
¦
V
Server 2: The HTML provider. Reads the XML, and decrypts/unlocks it, then sends HTML/JavaScript/JSON to the browser to apply to the map.
This should do it. I do something very similar, except our XML is open. It could also easily be locked.
I hashed together the code for this gmap from a couple of sources...
Mike Williams' Google Maps API Tutorial at the Blackpool Community Church Javascript Team;
and Tom Anthony's Geocoding UK Postcodes with Google Map API
...and frankly, I don't know what I'm doing with it. I don't know if the XML is loaded as JSON or not. Sadly, I wouldn't know where to begin.
I don't suppose this is the kind that I could pay a developer for? Any idea of the development time this might take (since you've done it yourself)?
Also, would locking down the XML file require any kind of .htaccess? I'm on shared hosting and my ISP just won't let me do anything like that (grrrr...). However, I'm thinking of moving ISP anyway, heh
I don't suppose this is the kind that I could pay a developer for? Any idea of the development time this might take (since you've done it yourself)?
You can always pay a developer for this kind of thing. It would probably cost you $100 (US) and up. I'd think that this would be a day or two's worth of work. I wouldn't be up for doing it myself.
Also, would locking down the XML file require any kind of .htaccess? I'm on shared hosting and my ISP just won't let me do anything like that (grrrr...). However, I'm thinking of moving ISP anyway, heh
Yeah, a .htaccess is the best way to do it. However, if the file can be sent to a client, it can be read in its entirety. Basically, if you use JSON objects, you would be doing it a different way, and your server would need to have --with-xsl applied, which can be a pain to get.