Guest User

Untitled

a guest
Dec 7th, 2017
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. java.net.ProtocolException: Unexpected status line: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  2. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.http.StatusLine.parse(StatusLine.java:54)
  3. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
  4. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
  5. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:905)
  6. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:789)
  7. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:443)
  8. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)
  9. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:231)
  10. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at it.codesnippet.dots.LoginActivity$1$override.run(LoginActivity.java:49)
  11. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at it.codesnippet.dots.LoginActivity$1$override.access$dispatch(LoginActivity.java)
  12. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at it.codesnippet.dots.LoginActivity$1.run(LoginActivity.java:0)
  13. 07-10 11:18:54.112 24683-25081/it.codesnippet.dots W/System.err: at java.lang.Thread.run(Thread.java:818)
  14.  
  15. Thread loginCheckThread = new Thread(new Runnable() {
  16. public void run() {
  17. String result = "", dataObj = "";
  18. TextView username = (TextView) findViewById(R.id.login_mail);
  19. TextView password = (TextView) findViewById(R.id.login_password);
  20.  
  21. JSONObject jsonObj = new JSONObject();
  22. try {
  23. jsonObj.put("loginMail", username.getText());
  24. jsonObj.put("loginPassword", password.getText());
  25. dataObj = jsonObj.toString(0);
  26. } catch (JSONException e) {
  27. e.printStackTrace();
  28. }
  29.  
  30. try {
  31. URL url = new URL("http://myserver.it/testandroid.php?data=" + dataObj);
  32. HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  33.  
  34. try {
  35. /* line #49 */ InputStream in = new BufferedInputStream(urlConnection.getInputStream());
  36. ByteArrayOutputStream bo = new ByteArrayOutputStream();
  37. int i = in.read();
  38. while (i != -1) {
  39. bo.write(i);
  40. i = in.read();
  41. }
  42. result = bo.toString();
  43. } catch (IOException e) {
  44. result = "Exception: Class::IOStream Related";
  45. e.printStackTrace();
  46.  
  47. } finally {
  48. urlConnection.disconnect();
  49. }
  50. } catch (IOException e) {
  51. result = "Exception: Class::URL Related";
  52. }
  53.  
  54. System.out.println(result);
  55. }
  56. });
  57. loginCheckThread.start();
  58.  
  59. InputStream in = new BufferedInputStream(urlConnection.getInputStream());
  60.  
  61. $jsonObj = json_decode($_GET["data"], TRUE);
  62.  
  63. echo $jsonObj["loginMail"] . " - " . $jsonObj["loginPassword"];
  64.  
  65. HTTP/1.1 200 OK
  66. Date: Sun, 10 Jul 2016 10:02:42 GMT
  67. Content-Type: text/html
  68. Content-Length: 6920
  69. Last-Modified: Sun, 10 Jul 2016 04:00:22 GMT
  70. Connection: keep-alive
  71. Accept-Ranges: bytes
  72.  
  73. Here goes the content.
  74.  
  75. java.net.ProtocolException: Unexpected status line: <!DOCTYPE HTML PUBLIC β€œ-//IETF//DTD HTML 2.0//EN”>
Add Comment
Please, Sign In to add comment