I need an alternative option to HttpClient in Android to send data to PHP as it is no longer supported

I’ve also encountered with this problem to solve that I’ve made my own class. Which based on java.net, and supports up to android’s API 24 please check it out: HttpRequest.java Using this class you can easily: Send Http GET request Send Http POST request Send Http PUT request Send Http DELETE Send request without extra … Read more

How to enable logging for apache commons HttpClient on Android

Ignore my earlier comment. I found the solution on the org.apache.http logging page. Your original answer was referring to httpclient-3.x logging, and the working code for recent versions comes from http-components logging java.util.logging.Logger.getLogger(“org.apache.http.wire”).setLevel(java.util.logging.Level.FINEST); java.util.logging.Logger.getLogger(“org.apache.http.headers”).setLevel(java.util.logging.Level.FINEST); System.setProperty(“org.apache.commons.logging.Log”, “org.apache.commons.logging.impl.SimpleLog”); System.setProperty(“org.apache.commons.logging.simplelog.showdatetime”, “true”); System.setProperty(“org.apache.commons.logging.simplelog.log.httpclient.wire”, “debug”); System.setProperty(“org.apache.commons.logging.simplelog.log.org.apache.http”, “debug”); System.setProperty(“org.apache.commons.logging.simplelog.log.org.apache.http.headers”, “debug”); and properties: adb shell setprop log.tag.org.apache.http VERBOSE adb shell setprop log.tag.org.apache.http.wire … Read more

How to handle invalid SSL certificates with Apache HttpClient? [duplicate]

https://mms.nw.ru uses a self-signed certificate that’s not in the default trust manager set. To resolve the issue, do one of the following: Configure SSLContext with a TrustManager that accepts any certificate (see below). Configure SSLContext with an appropriate trust store that includes your certificate. Add the certificate for that site to the default Java trust … Read more

Android deprecated apache module (HttpClient, HttpResponse, etc.)

The method HttpClient was deprecated. You can now use the URLConnection as you can see in this example: private StringBuffer request(String urlString) { // TODO Auto-generated method stub StringBuffer chaine = new StringBuffer(“”); try{ URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestProperty(“User-Agent”, “”); connection.setRequestMethod(“POST”); connection.setDoInput(true); connection.connect(); InputStream inputStream = connection.getInputStream(); BufferedReader rd = … Read more

org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)

If you change your compileSdkVersion to 21, your app will compile cleanly. That being said, there are reasons why Google is backing away from the built-in HttpClient implementation, so you probably should pursue some other library. That “some other library” could be: the built-in classic Java HttpUrlConnection, though as you have found, its API leaves … Read more