/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication3;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class HttpPostForm {
{
try {
// Construct data
// Send data
URL url
= new URL("https://2...content-available-to-author-only...h.hk/pr/res/668341.html"); conn.setDoOutput(true);
wr.write(data);
wr.flush();
// Get the response
while ((line = rd.readLine()) != null) {
}
wr.close();
rd.close();
}
}
}
LyoKICogVG8gY2hhbmdlIHRoaXMgbGljZW5zZSBoZWFkZXIsIGNob29zZSBMaWNlbnNlIEhlYWRlcnMgaW4gUHJvamVjdCBQcm9wZXJ0aWVzLgogKiBUbyBjaGFuZ2UgdGhpcyB0ZW1wbGF0ZSBmaWxlLCBjaG9vc2UgVG9vbHMgfCBUZW1wbGF0ZXMKICogYW5kIG9wZW4gdGhlIHRlbXBsYXRlIGluIHRoZSBlZGl0b3IuCiAqLwpwYWNrYWdlIGphdmFhcHBsaWNhdGlvbjM7CgogCmltcG9ydCBqYXZhLmlvLkJ1ZmZlcmVkUmVhZGVyOwppbXBvcnQgamF2YS5pby5JT0V4Y2VwdGlvbjsKaW1wb3J0IGphdmEuaW8uSW5wdXRTdHJlYW1SZWFkZXI7CmltcG9ydCBqYXZhLmlvLk91dHB1dFN0cmVhbVdyaXRlcjsKaW1wb3J0IGphdmEubmV0Lk1hbGZvcm1lZFVSTEV4Y2VwdGlvbjsKaW1wb3J0IGphdmEubmV0LlVSTDsKaW1wb3J0IGphdmEubmV0LlVSTENvbm5lY3Rpb247CmltcG9ydCBqYXZhLm5ldC5VUkxFbmNvZGVyOwoKcHVibGljIGNsYXNzIEh0dHBQb3N0Rm9ybSB7CiAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBNYWxmb3JtZWRVUkxFeGN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