마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

파라미터를 보내고 싶은데 어떻게 하면 되는가요?

0 추천

안녕하세요^^추석 연휴 잘 보내셨나요~

adid와 ipAddress 파라미터를 void processing_Data2()에도 보내고 싶은데 어떻게 하면 되는가요?

매번 감사드립니다~


private void onT2(String adid, String ipAddress) {

URL url = null;
try {
url = new URL("http://www?" + "os=" + os + "&ap=" + ap + "&a=" + a +"&ua=" + adid + "&ud=" + ud + "&ajip=" + ipAddress);
Log.d("F2", url.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
@SuppressWarnings("unused")
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
} catch (IOException e) {
e.printStackTrace();
}
}

String line2 = null;
String page2 = "";
EditText et_webpage_src2;
EditText etRusult;
EditText etUrl;
@SuppressLint("HandlerLeak")


void processing_Data2() {
Properties prop = new Properties();
prop.setProperty("etRusult", etRusult.getText().toString());
prop.setProperty("etUrl", etUrl.getText().toString());
String encodedString = encodeString(prop);
URL url = null;
HttpURLConnection urlConnection = null;
BufferedInputStream buf = null;
try {
Log.e("", "processing_Data1"+ line2);
// URL 접속
url = new URL("http://www?" + "os=" + os + "&ap=" + ap + "&a=" + a +"&ua=" + adid + "&ud=" + ud + "&ajip=" + ipAddress);
Log.d("F1", url.toString());
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);

urlConnection.setUseCaches(false);

urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
DataOutputStream out = null;
Log.e("", "processing_Data2"+ line2);
out = new DataOutputStream(urlConnection.getOutputStream());
out.writeBytes(encodedString);
out.flush();

buf = new BufferedInputStream(urlConnection.getInputStream());

BufferedReader bufreader = new BufferedReader(new InputStreamReader(buf, "utf-8"));

while ((line2 = bufreader.readLine()) != null) {
page2 += line2;
Log.e("", ""+ line2);
}
if(!page.isEmpty()) {
buiHandler21.sendEmptyMessage(0);
}
} catch (Exception e){

Log.e("", "processing_Data1"+ e.getMessage());

} finally {

urlConnection.disconnect();
}
Log.e("", ""+ page2);
}
}

marimari (520 포인트) 님이 2015년 9월 29일 질문

1개의 답변

0 추천
DATA 를 PLAIN으로 보내시면 안되고 URL ENCODE 해서 보내세요
aucd29 (218,390 포인트) 님이 2015년 9월 30일 답변
...