这里首先要向 url 发出 http 请求,然后想将一些数据发布到 user.here 我正在使用的输入的 url 中JSOUP
。任何人都可以提出一些简单的方法。对 Ktutorial 感到困难。按照这个任何人建议任何示例或简单的教程。提前致谢
在此处添加代码
String strResp = null;
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(
"http://motinfo.direct.gov.uk/internet/jsp/ECHID-Internet-History-Request.jsp");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair(
"Vehicle registration mark from number plate", "DU06BFZ"));
nameValuePairs
.add(new BasicNameValuePair(
" MOT test number from-VT20 test certificate-VT30 refusal certificate ",
"435294573022"));
/*
* nameValuePairs.add(new BasicNameValuePair("MOT test number",
* "000000"));
*/
try {
loadingProgressBar = (ProgressBar) findViewById(R.id.progressBar1);
loadingProgressBar.setVisibility(View.VISIBLE);
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(post);
strResp = EntityUtils.toString(response.getEntity());
Document document = Jsoup.parse(strResp);
Element link = document.select("a").first();
String text = document.body().text();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return strResp;
}