带有httpget的Android httppost

时间:2012-01-14 13:49:32

标签: android http-post http-get

首先。对不起我的坏事。

我想编写一个程序,可以通过post / get参数与我的网站进行通信,但是当我使用http://xyz.xyz/?server&user=this&pass=that运行进度httppost时 它不起作用......如果我能做到这一点,我怎么能解决这个问题。

sintax

GET

  1. 用户名
  2. 密码
  3. POST

    1. 消息
    2. 验证码
    3. 我知道存在两种方法,但我不知道这两种方法的共同进展。

      (httppost / httpget方法;但在一起......我需要它)

      感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我没有完全理解您的问题,但如果您想登录网站(HTTP POST等等),以下链接可能有所帮助。

http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient

另外,请注意,示例中给出的“stringdata”和“id”是html代码中输入参数的id。

        <input id="___THIS HERE___" value="..etc" >

根据你的问题,我会说你这样做:

...
        nameValuePairs.add(new BasicNameValuePair("user", "this"));
        nameValuePairs.add(new BasicNameValuePair("pass", "that"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
...
相关问题