Hi Mark, if you are asking how to make a POST request then I would
have a look at the the java.net.URL and java.net.HttpURLConnection
classes.

Here is the gist of it:

URL u = new URL("http://your.remote.api...";);
HttpURLConnection http = (HttpURLConnection) u.openConnection();    //
create an HTTP connection
http.setDoOutput(true);                                             //
declare that you want to write to the connection
http.setRequestMethod("POST");
OutputStream os = http.getOutputStream();
os.write(....);                                                     //
write whatever you want to the post body
os.close();
http.connect();                                                     //
actually make the connection to your server
InputStream is = http.getInputStream();
is.read(...);                                                       //
process the response
is.close();

Although I am not doing that in my example, don't forget to close
streams in a finally clause and to handle the exceptions.

Greg

On Jan 22, 2:08 pm, Mark Hansen <stonedon...@gmail.com> wrote:
> I have an API I'm using that requires me to POST instead of use GET to
> submit my credentials before receiving back my XML response.
>
> I've parsed a bunch of various XML services like this, but this is the
> first time I've run across having to post to the URL.
>
> Basically they want a username and password parameter submitted as a
> post to the URL before the XML is fed back.
>
> Does anyone have a working example, or maybe able to point me in the
> right direction?
>
> Thanks,
> Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to