1

so this is for a project im doing for my school in which we need a backend. our current setup is that the foreground is an android app, whereas the backend is a mySQL database that is located within my school's servers. The android app is supposed to interact with the mySQL database using a php script.

my php script is set currently hardcoded to return one single row from the mySQL database in JSON format.

my android code is as follows:

public static final String KEY = "URL of my PHP script";
InputStream is = null;
String result = "";
try{

        HttpClient httpclient = new DefaultHttpClient();
        HttpGet request = new HttpGet();
        request.setURI(new URI(KEY));
        Log.d(null,"there");
        HttpResponse response = httpclient.execute(request);
        Log.d(null, "here");
        HttpEntity entity = response.getEntity();
        is = entity.getContent();

}catch(Exception e){
        Log.e("log_tag", "Error in http connection "+e.toString());
}

However, I get an exception at the line

HttpResponse response = httpclient.execute(request);

in which the error says: No Peer Certificate.

Anyone know what's wrong with it, and how to fix it?

Alex Zhang
  • 75
  • 1
  • 5

1 Answers1

0

I have the same issue. This link worked for part of my needs. http://www.knowledgebit.appspot.com/zahangirbd/TopicView.action;jsessionid=E2BZt_6bp4uFFbMyq42gWg?id=56001

however, there is still an issue with some links(i believe im not providing the proper certificate)

EDIT: so it turns out that the order of the certificates were the problem.

check this out, this helped me.. Apache HttpClient on Android producing CertPathValidatorException (IssuerName != SubjectName)

Community
  • 1
  • 1