http header:
Set-Cookie:ONE_VER=1_0;
http body:
<validateticket>
<ticket>{ the One-Time Ticket from ASUS Access}</ticket>
<validateticket>
httpclient要将这些参数发送出去,希望高手能指点一下,最好能写出源码,post请求!!万分感谢!!!
http header:
Set-Cookie:ONE_VER=1_0;
http body:
<validateticket>
<ticket>{ the One-Time Ticket from ASUS Access}</ticket>
<validateticket>
httpclient要将这些参数发送出去,希望高手能指点一下,最好能写出源码,post请求!!万分感谢!!!
private static void post() throws IOException{
URL url = new URL(" http://www.baidu.com");// 提交地址
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoOutput(true);// 打开写入属性
httpURLConnection.setDoInput(true);// 打开读取属性
httpURLConnection.setRequestMethod("POST");// 设置提交方法
httpURLConnection.setRequestProperty("Content-Type","text/xml;charset=UTF-8");//
httpURLConnection.setRequestProperty("SOAPAction", " http://WebXml.com.cn/getWeatherbyCityName");
httpURLConnection.setRequestProperty("User-Agent", "Jakarta Commons-HttpClient/3.1");
httpURLConnection.setConnectTimeout(50000);// 连接超时时间
httpURLConnection.setReadTimeout(50000);
httpURLConnection.connect();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(httpURLConnection.getOutputStream()));
out.write("name=1&pwd=2");
out.flush();
out.close();
//读取post之后的返回值
BufferedReader in = new BufferedReader(new InputStreamReader((InputStream) httpURLConnection.getInputStream(),"UTF-8"));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = in.readLine()) != null) {
sb.append(line);
}
in.close();
System.out.println("client:" + sb.toString());
httpURLConnection.disconnect();//断开连接
}
不行 贴出你的联系方式