Я пытаюсь перехватить переменную в коде html, это идентификатор сессии каждого пользователя, и затем я могу отправить ее из веб-просмотра на mysql, но у меня ничего не получилось, может кто-нибудь мне помочь с этим? не имеет значения, если javascript используется без проблем, но я не знаю, как это сделать
protected String doInBackground(String... arg0) {
try {
URL url = new URL("https://www.example.com/receive.php"); // here is your URL path
JSONObject postDataParams = new JSONObject();
postDataParams.put("name", "abc");
postDataParams.put("email", "abc@gmail.com");
Log.e("params",postDataParams.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(15000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(getPostDataString(postDataParams));
writer.flush();
writer.close();
os.close();
int responseCode=conn.getResponseCode();
if (responseCode == HttpsURLConnection.HTTP_OK) {
BufferedReader in=new BufferedReader(new
InputStreamReader(
conn.getInputStream()));
StringBuffer sb = new StringBuffer("");
String line="";
while((line = in.readLine()) != null) {
sb.append(line);
break;
}
in.close();
return sb.toString();
}
else {
return new String("false : "+responseCode);
}
}
catch(Exception e){
return new String("Exception: " + e.getMessage());
}
}