我doget方法可以 但dopost就不行啊
代码在这
private void doPost(){
StringBuffer sb=new StringBuffer();
URL httpurl;
try {
httpurl = new URL(url);
HttpURLConnection conn=(HttpURLConnection) httpurl.openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("POST");
OutputStream out=conn.getOutputStream();
String connent="name"+name+"&age"+age;
out.write(connent.getBytes());
BufferedReader bufferedReader=new BufferedReader
(new InputStreamReader(conn.getInputStream()));
String str;
while((str=bufferedReader.readLine())!=null)
{
sb.append(str);
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}