java.net.unknownhostexception unable to resolve host

后端 未结 1 1548
走了就别回头了
走了就别回头了 2021-01-24 05:23

Ive just been trying to get a simple login script working, my PHP is out of date its crappy, but i have an iOS version of this same app that works fine logging in, i know nothin

相关标签:
1条回答
  • 2021-01-24 06:24

    It might seem radical but throw out your CustomHttpClient.java and start using a library such as Android Asynchronous Http Client. I would be very surprised if you still had the problem after switching to a library that takes care of all that stuff for you. Example:

    AsyncHttpClient client = new AsyncHttpClient();
    RequestParams rp = new RequestParams();
    rp.put("email", un.getText().toString());
    rp.put("password", pw.getText().toString());
    client.post("http://www.mywebsite.com/thatoneloginscript.php", rp, new AsyncHttpResponseHandler() {
        @Override
        public final void onSuccess(String response) {
            // handle your response here
        }
    
        @Override
        public void onFailure(Throwable e, String response) {
            // something went wrong
        }               
    });
    
    0 讨论(0)
提交回复
热议问题