아래 코드를 사용하여 로그인 자격 증명을 확인하십시오. 응답이 OK이면 다른 매개 변수로 아래의 동일한 코드를 사용하여 url에 파일을 보내십시오. 원하는 건 뭐든 할거야.
URL siteUrl;
try {
siteUrl = new URL("yoururl");
HttpURLConnection conn = (HttpURLConnection) siteUrl
.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
String content1 = "";
//Here param is the Map<String,String> which holds the value of email and password
Set getkey = param.keySet();
Iterator keyIter = getkey.iterator();
String content = "";
for (int i = 0; keyIter.hasNext(); i++) {
Object key = keyIter.next();
if (i != 0) {
content += "&";
}
content += key + "=" + param.get(key);
}
//Check by printing here
System.out.println(content);
out.writeBytes(content.trim());
out.flush();
out.close();
BufferedReader in = new BufferedReader(new InputStreamReader(
conn.getInputStream()));
String line = "";
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
} catch (MalformedURLException e) {
e.printStackTrace();
}
은 로그인 생성하고 토큰을 반환 할 수 있습니다, 당신은 사용자가 처음 로그인되어 있는지 확인하려면이
을 도움이되기를 바랍니다. 그런 다음 reply (token, file, title)가 필요합니다. – mario