• <i id='uLRjM'><tr id='uLRjM'><dt id='uLRjM'><q id='uLRjM'><span id='uLRjM'><b id='uLRjM'><form id='uLRjM'><ins id='uLRjM'></ins><ul id='uLRjM'></ul><sub id='uLRjM'></sub></form><legend id='uLRjM'></legend><bdo id='uLRjM'><pre id='uLRjM'><center id='uLRjM'></center></pre></bdo></b><th id='uLRjM'></th></span></q></dt></tr></i><div id='uLRjM'><tfoot id='uLRjM'></tfoot><dl id='uLRjM'><fieldset id='uLRjM'></fieldset></dl></div>

      <legend id='uLRjM'><style id='uLRjM'><dir id='uLRjM'><q id='uLRjM'></q></dir></style></legend>

      <small id='uLRjM'></small><noframes id='uLRjM'>

      • <bdo id='uLRjM'></bdo><ul id='uLRjM'></ul>
        <tfoot id='uLRjM'></tfoot>
      1. 通过 Android 应用程序登录 https 网站

        时间:2023-05-19
          1. <legend id='Y7N3D'><style id='Y7N3D'><dir id='Y7N3D'><q id='Y7N3D'></q></dir></style></legend>
                <bdo id='Y7N3D'></bdo><ul id='Y7N3D'></ul>

                    <tbody id='Y7N3D'></tbody>
                  <tfoot id='Y7N3D'></tfoot>

                  <i id='Y7N3D'><tr id='Y7N3D'><dt id='Y7N3D'><q id='Y7N3D'><span id='Y7N3D'><b id='Y7N3D'><form id='Y7N3D'><ins id='Y7N3D'></ins><ul id='Y7N3D'></ul><sub id='Y7N3D'></sub></form><legend id='Y7N3D'></legend><bdo id='Y7N3D'><pre id='Y7N3D'><center id='Y7N3D'></center></pre></bdo></b><th id='Y7N3D'></th></span></q></dt></tr></i><div id='Y7N3D'><tfoot id='Y7N3D'></tfoot><dl id='Y7N3D'><fieldset id='Y7N3D'></fieldset></dl></div>

                  <small id='Y7N3D'></small><noframes id='Y7N3D'>

                  本文介绍了通过 Android 应用程序登录 https 网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  首先,我对此很陌生.我是 Android、asp、javascript 甚至 http 的新手.

                  First off, I'm pretty newb at this. I'm new to Android, to asp, to javascript, to http even.

                  我正在尝试构建一个 Android 应用程序,允许我登录到我学校的网站并从中提取数据,最终我希望做一些事情,比如将我的时间表数据插入到 Android 的日历条目中.但是我无法登录.

                  I'm trying to build an Android app that allows me to login to my school's website and pull data off it, ultimately I hope to do something like insert my timetable's data into Android's calendar entries. However I'm having trouble logging in.

                  这是网站:https://sso.wis.ntu.edu.sg/webexe88/owa/sso_login2.asp

                  我目前正在做的是对上述 URL 进行 http POST,我希望被重定向到 hhttps://wish.wis.ntu.edu.sg/pls/webexe/aus_stars_check.check_subject_web2这将显示我的时间表.

                  What I'm doing currently is doing a http POST to the above-mentioned URL and I'm hoping to be redirected to hhttps://wish.wis.ntu.edu.sg/pls/webexe/aus_stars_check.check_subject_web2 which will display my timetable.

                  查看网页源码并在网上搜索了一番后,目前我的代码如下:

                  So far my code is as follows after viewing the webpage's source and searching quite a bit on the Internet:

                  private void start_login(String[] array) {
                      // TODO Auto-generated method stub
                      Toast.makeText(this, "Logging in...", Toast.LENGTH_LONG).show();
                  
                      WebView wv = new WebView(this);     
                      this.setContentView(wv);
                  
                      try {
                  
                          ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);
                          nameValuePairs.add(new BasicNameValuePair("UserName", <my username here>));
                          nameValuePairs.add(new BasicNameValuePair("PIN", <my password here>));
                          nameValuePairs.add(new BasicNameValuePair("Domain", "STUDENT"));
                          nameValuePairs.add(new BasicNameValuePair("p2", "https://wish.wis.ntu.edu.sg/pls/webexe/aus_stars_check.check_subject_web2"));
                  
                          wv.loadData(CustomHttpClient.executeHttpPost(URL, nameValuePairs), "text/html", "utf-8");
                  
                      } catch (Exception e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                  
                  }// end start_login
                  

                  这就是登录功能.

                  我使用的 CustomHttpClient 多亏了这个人:http://www.newtondev.com/2010/07/27/making-http-requests-using-google-android/

                  The CustomHttpClient I'm using is thanks to this guy: http://www.newtondev.com/2010/07/27/making-http-requests-using-google-android/

                  到目前为止,我没有得到任何结果.我究竟做错了什么?我是在 ArrayList 中缺少值,还是我的 URL 都错了?

                  So far I'm not getting any results. What am I doing wrong? Am I missing values in the ArrayList, or have I got the URL all wrong?

                  推荐答案

                  下面的代码处理 https 并为 https url 提供 httpsclient .. 你需要 httpsclient 来向 https url 发出请求.

                  Below code handles https and gives httpsclient for https url .. you need httpsclient to make request to https urls.

                  下面的代码可能对你有帮助:

                  Might below code is of help to you:

                  public DefaultHttpClient getClient() 
                     {
                          DefaultHttpClient ret = null;
                  
                          //sets up parameters
                          HttpParams params = new BasicHttpParams();
                          HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
                          HttpProtocolParams.setContentCharset(params, "utf-8");
                          params.setBooleanParameter("http.protocol.expect-continue", false);
                  
                          //registers schemes for both http and https
                          SchemeRegistry registry = new SchemeRegistry();
                          registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
                          final SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
                          sslSocketFactory.setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
                          registry.register(new Scheme("https", sslSocketFactory, 443));
                  
                          ThreadSafeClientConnManager manager = new ThreadSafeClientConnManager(params, registry);
                          ret = new DefaultHttpClient(manager, params);
                          return ret;
                      }
                  

                  这篇关于通过 Android 应用程序登录 https 网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:IOS 6屏幕旋转不使用情节提要 下一篇:从 NSDate 获取 NSDate 调整时区

                  相关文章

                  <i id='k28tK'><tr id='k28tK'><dt id='k28tK'><q id='k28tK'><span id='k28tK'><b id='k28tK'><form id='k28tK'><ins id='k28tK'></ins><ul id='k28tK'></ul><sub id='k28tK'></sub></form><legend id='k28tK'></legend><bdo id='k28tK'><pre id='k28tK'><center id='k28tK'></center></pre></bdo></b><th id='k28tK'></th></span></q></dt></tr></i><div id='k28tK'><tfoot id='k28tK'></tfoot><dl id='k28tK'><fieldset id='k28tK'></fieldset></dl></div>

                    1. <tfoot id='k28tK'></tfoot>

                      • <bdo id='k28tK'></bdo><ul id='k28tK'></ul>

                      <small id='k28tK'></small><noframes id='k28tK'>

                      <legend id='k28tK'><style id='k28tK'><dir id='k28tK'><q id='k28tK'></q></dir></style></legend>