0
我使用HttpUrlConnection来连接一个Web服务,我有一个窗体和一个按钮。Post with HTTPUrlConnection
源代码的部分是:
<form action="main.php4?page=markt3art=UIN=484504321483db0fc35d1e8e660b99c8&x=&y=filled=1" method="POST">
<input type="hidden" value="" name="p"></input>
<input type="hidden" value="1755219" name="buy2f8d0"></input>
<input type="hidden" value="1755219" name="buy"></input>
<input type="text" value="323" size="9" maxlength="16" name="teilkauf"></input>
<img width="1" hspace="20" height="1" src="pics/leer.gif"></img>
<input class="send" type="submit" value=" buy "></input>
</form>
我在做什么是:(www是网站的http:// ...)
URL url = new URL(www);
HttpURLConnection conexion = (HttpURLConnection)url.openConnection();
String forSending = "1";
String charset = "UTF-8";
String stringToSend = URLEncoder.encode(forSending, charset);
conexion.setDoOutput(true);
conexion.setRequestMethod("POST");
OutputStreamWriter out = new OutputStreamWriter(
conexion.getOutputStream());
out.write("teilkauf=" + stringToSend);
out.flush();
out.close();
但它不”工作。任何帮助?谢谢。
难道我只有通过HTTP来改变WWW(网站) ://...main.php4页= markt3art = UIN = 484504321483db0fc35d1e8e660b99c8&X =&Y =填充= 1?因为它不起作用。 (对不起我的英语不好)。 – Kakuti
您可能需要在每次要发布该数据时都要获取该UIN令牌。 –