Skip to content Skip to sidebar Skip to footer

Connect To Php Page Using .htaccess With Android Application

i've a locked php page (username and password) by .htaccess file, how can i do to connect to this php with my android application? My function to connect is : String conn(JSONObje

Solution 1:

You can add this code for BASIC authentication in HttpPost object:

HttpPost request = new HttpPost("http://olbolb.org/Hihi/"+page);
request.setHeader("Authorization", "Basic " + 
   new Base64().encodeToString("username:password".getBytes("UTF-8"), Base64.DEFAULT) );

Post a Comment for "Connect To Php Page Using .htaccess With Android Application"