How to properly post data from android to government page

时间:2017-04-30 02:04:07

标签: php android database

I am trying to build app that help to post data to government site so that it will be easy for all.I am posting data form android phone but I think data does not get posted there. If there is empty page loaded then it gives message that Page has Expired. Can any body help? I can reward you if it succeeds. Its my emergency project.

Page url- "webrecharge.ntc.net.np"
posting url "http://webrecharge.ntc.net.np/Result.jsp"

Android posting code is

  String postData =
                    URLEncoder.encode("servicetype", "UTF-8") + "=" + URLEncoder.encode((params[0]), "UTF-8") + "&" +
                    URLEncoder.encode("mdn", "UTF-8") + "=" + URLEncoder.encode((params[1]), "UTF-8") + "&" +
                    URLEncoder.encode("pinno", "UTF-8") + "=" + URLEncoder.encode((params[2]), "UTF-8") + "&" +
                    URLEncoder.encode("captext", "UTF-8") + "=" + URLEncoder.encode(params[3], "UTF-8");

But i think it does not post properly. THanks

1 个答案:

答案 0 :(得分:0)

试试这个并且知道它是否对你有所帮助

 BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(o, "UTF-8"));

        String postData = URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(email, "UTF-8");
        writer.write(postData);
  writer.flush();
        writer.close();
        o.close();
        backresult = "";
      ...