【问题标题】:Android httppost with httpget带有 httpget 的 Android httppost
【发布时间】:2012-01-14 13:49:31
【问题描述】:

首先。对不起我的英语不好。

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

语法

获取

  1. 用户名
  2. 密码

发布

  1. 留言
  2. 验证码

我知道这有两种方法,但我不知道这两种方法一起取得的进展。

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

感谢您的帮助

【问题讨论】:

    标签: android http-post http-get


    【解决方案1】:

    我没有完全理解你的问题,但是如果你想登录一个网站(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));
    ...
    

    【讨论】:

    • 我的问题已完成,但您的回答很好,这是最好的方法。谢谢您的帮助:)
    猜你喜欢
    • 2014-10-28
    • 2023-03-15
    • 2015-07-06
    • 2021-07-29
    • 1970-01-01
    • 2011-03-25
    • 2013-05-29
    • 2013-03-01
    • 1970-01-01
    相关资源
    最近更新 更多