I'm trying to create a XMLHelper class for my game where I want to save and load XML's files from my server.
I would like to know how to upload and download this XMLs from there.
Thanks for all!
asked Jan 19 '10 at 04:10 PM
Grabbing and sending XML data to and from a server can be done with the WWW class to call scripts on your server.
Since XML is just text, you can use the basic WWW functions to call a URL, and read the 'WWW.data' variable to get your XML. EG:
Similarly, you can use the WWWForm class to POST some XML data as a string to a script on your server. Assuming "myXMLString" contains the XML data that you want to post to your server, you could use this:
To download your XML files, just use
and then use www.data or www.bytes, to access the data, which you can then process as XML (for example using the .NET Xml classes).
Uploading data (if you want to use http) works the same way, there's a version of the WWW constructor which takes data to upload as a second parameter:
answered Jan 19 '10 at 05:24 PM
jonas echterhoff ♦♦