PDA

View Full Version : Inserting remotely hosted xml into an html document...


Firoki
07-18-2006, 07:54 PM
Hi everybody, i need help inserting xml information in an html document. I know this is possible, infact you can see it in action at donkiddick.phpnet.us/ie_and_ff.html. But it's only working when i host the xml file.

I actually want to 'embed' the data into my document, from a different website: ws.audioscrobbler.com/1.0/user/firoki/topartists.xml

coothead at HTMLForums.com has already given me loads of help on this, he's the one where ALL of the coding has come from so far. (htmlforums.com/showthread.php?t=79068)

The problem occurs when i change:
xmlDoc.load('topartists.xml')
to:
xmlDoc.load('http://ws.audioscrobbler.com/1.0/user/firoki/topartists.xml')

The change can be seen in donkiddick.phpnet.us/ie_and_ff_non_hosted.html


Hope ive got my point accross,
thanks in advance
Firoki

KC-Luck
07-18-2006, 08:33 PM
That is a security risk to load content from a domain outside of your own, so you can't do that "client-side."

You can have your server grab a copy of the content, and "cache" it to your domain (if allowed by the other domain's copyright laws) and then just link to that with no security issues.

Firoki
07-18-2006, 08:39 PM
How do i do the 'caching'?

You dont mean downloading and re-hosting do you?

KC-Luck
07-18-2006, 09:50 PM
yes, that would be what i made reference to.
the server would download save a recent copy (at some intervals, only if new, blah), store locally, so you could reference it via a "same domain" address.

or, users would have to turn off the security features, and allow "cross-domain" queries to happen in your page.

Firoki
07-19-2006, 10:55 AM
I can make the server do this on its own? How would i do that? (its not my server by the way)

KC-Luck
07-19-2006, 03:16 PM
you would want to check in the "server-side" forums under which language you can use upon that server (ASP, ASP.net, PHP, etc)

Firoki
07-20-2006, 12:12 PM
Do you mean the forums on phpnet.us? Because there isnt any on there.

I think PHP is the only script i can use other than HTML, i havent tried any more...

KC-Luck
07-20-2006, 03:32 PM
No there are php forums on these forums as well..
http://www.codingforums.com/forumdisplay.php?f=4