Skip to content Skip to sidebar Skip to footer

Java.net.unknownhostexception Unable To Resolve Host

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 nothings

Solution 1:

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
    }               
});

Post a Comment for "Java.net.unknownhostexception Unable To Resolve Host"