以下是我在c++里面利用http协议发送的http数据包
POST /HttpFrontServlet HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Content-Type: multipart/form-data
User Agent: ZTE/A206
TermType: ZTE_XXX
Content-Length: 52
[13800130888,201101010011500000,T01,12,[email protected]@[email protected]@[email protected]]
那我现在在android里面想通过 HttpPost来发送以上的数据,我不清楚
TermType:ZTE_XXX这个数据怎么传入
[13800130888,201101010011500000,T01,12,[email protected]@[email protected]@[email protected]] 这个数据怎么传入?
String url = "http://211.140.2.123:8080/terminal/gprs";
HttpPost httpRequest = new HttpPost(url);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add();?????这里怎么写?
try
{
httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
if( httpResponse.getStatusLine().getStatusCode() == 200 )
{
String strResult = EntityUtils.toString(httpResponse.getEntity());
textView.setText(strResult);
}
else
{
textView.setText(""+httpResponse.getStatusLine().getStatusCode());
}
}
catch(Exception e )
{
}
------解决方案--------------------
嗯 怎么写 会的帮帮忙
------解决方案--------------------
为啥不用HttpURLConnection?