Пытаюсь подключить мобильное приложение к серверу, который хранится на хостинге При отладке вылетает в cetch на строке OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); Не подскажите где я дурак? ) может с url что накосячил Код (Javascript): protected String doInBackground(String... arg0) { try { String username = (String) arg0[0]; String password = (String) arg0[1]; String link = "http://thost1563261/fuchs42.ru/htdocs/arduino/index.php"; String data = URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(username, "UTF-8"); data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8"); URL url = new URL(link); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; // Read Server Response while ((line = reader.readLine()) != null) { sb.append(line); break; } return sb.toString(); } catch (Exception e) { return new String("Exception: " + e.getMessage()); } --- Добавлено --- на хостинге PHP: <?php $password=$_POST["password"]; $username=$_POST["username"]; echo "ddddddd"; echo $username; echo $password; ?>
что например здесь можно разбить? я с мобильного приложения ни разу не отправлял... может на сервере что-нить открыть нужно? --- Добавлено --- знаяения при отладке Код (Javascript): this = {Signin@4742} arg0 = {String[2]@4746} username = "gydy" password = "dydgyggydy" link = "http://thost1563261/fuchs42.ru/htdocs/arduino/index.php" data = "username=gydy&password=dydgyggydy" url = {URL@4769} "http://thost1563261/fuchs42.ru/htdocs/arduino/index.php" conn = {HttpURLConnectionImpl@4773} "com.android.okhttp.internal.huc.HttpURLConnectionImpl:http://thost1563261/fuchs42.ru/htdocs/arduino/index.php" client = {OkHttpClient@4780} fixedContentLength = -1