java - Android can't access a web server? -
so i've got little script set on server says whether user log in able or not. when accessing url http:server-url/username/password/ string returned called "correct" or "incorrect".
what i'm doing in android app following:
httpclient httpclient = new defaulthttpclient(); string url = "http://server-url/"+usernametext+"/"+passwordhash+"/"; httppost httppost = new httppost(url); responsehandler<string> handler = new basicresponsehandler(); try { string response = httpclient.execute(httppost, handler); log.e("logged in",response); } catch (clientprotocolexception e) { log.e("clientprotocolexception",e.tostring()); } catch (ioexception e) { log.e("ioexception","error"); }
i'm getting error:
04-29 14:31:15.728: error/clientprotocolexception(9366): org.apache.http.client.httpresponseexception: forbidden
but website works fine when access through browser? these settings have set correctly somewhere on server, or forgetting in code?
thanks!
did think of giving internet permission?
<uses-permission android:name="android.permission.internet"/>
Comments
Post a Comment