Hi.
I have a simple android app that posts data to a php page where i just
print out GETand POST variable named "quest".

Problem is that i can't get HttpClient to add the "quest" POST
parameter.  Why is the parameter missing in the POST?

        DefaultHttpClient client = new DefaultHttpClient();
        HttpPost post = new HttpPost("http://jordarundt.org/
turen.php");
        client.getParams().setParameter("quest", "testing");
        post.getParams().setParameter("quest", "testing");
        BufferedReader br = null;

        try{
            HttpResponse response = client.execute(post);
            int returnCode = response.getStatusLine().getStatusCode();

            if(returnCode == HttpStatus.SC_NOT_IMPLEMENTED) {
                System.err.println("The Post method is not implemented
by this URI");
                // still consume the response body
                response.getEntity().getContent().toString();
            } else {
                br = new BufferedReader(new InputStreamReader
(response.getEntity().getContent()));
                String readLine;
                String innhold = "";
                while(((readLine = br.readLine()) != null)) {
                    innhold += readLine;
                }
                text.setText(innhold);
            }
        } catch (Exception e) {
            System.err.println(e);
        } finally {
            client.getConnectionManager().shutdown();
            if(br != null) try { br.close(); } catch (Exception fe) {}
        }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to