i need to access this website(http://tamilnadu.schools9.com/anna-university-grade-system-exam-results200114.htm) to get my result through a java program please help me how to interact with the page in a java program.
我需要访问这个网站(http://tamilnadu.schools9.com/anna-university-grade-system-exam-results200114.htm)通过java程序获取我的结果请帮我如何与页面进行交互java程序。
1 个解决方案
#1
3
You can use HttpClient from Apache HttpComponents:
您可以使用Apache HttpComponents中的HttpClient:
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet("http://tamilnadu.schools9.com/anna-university-grade-system-exam-results200114.htm");
CloseableHttpResponse response1 = httpclient.execute(httpGet);
try {
System.out.println(response1.getStatusLine());
HttpEntity entity1 = response1.getEntity();
Scanner scanner = new Scanner(entity1.getContent());
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
// TODO: do something with the line
System.out.println(line);
}
EntityUtils.consume(entity1);
} finally {
response1.close();
}
#1
3
You can use HttpClient from Apache HttpComponents:
您可以使用Apache HttpComponents中的HttpClient:
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet("http://tamilnadu.schools9.com/anna-university-grade-system-exam-results200114.htm");
CloseableHttpResponse response1 = httpclient.execute(httpGet);
try {
System.out.println(response1.getStatusLine());
HttpEntity entity1 = response1.getEntity();
Scanner scanner = new Scanner(entity1.getContent());
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
// TODO: do something with the line
System.out.println(line);
}
EntityUtils.consume(entity1);
} finally {
response1.close();
}