hi guys,
I'm working on an application using Android SO and Java. I would like to send an xml file as POST to a php server, that inserts the information from the xml into a database.
how can i do that?
regards :D
hi guys,
I'm working on an application using Android SO and Java. I would like to send an xml file as POST to a php server, that inserts the information from the xml into a database.
how can i do that?
regards :D
Here's how to POST xml with Java
String urlText = "http://example.com/someservice.php";
String someXmlContent = "<root><node>Some text</node></root>";
try {
HttpURLConnection c = (HttpURLConnection) new URL(urlText).openConnection();
c.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(c.getOutputStream(), "UTF-8");
writer.write(someXmlContent);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}