废话不多说,上代码!!亲测有效!
import .*;import java.io.*;public class ExpressQuery {public static void main(String[] args) {try {String url = "/query?type=快递公司代号&postid=快递单号";URL obj = new URL(url);HttpURLConnection con = (HttpURLConnection) obj.openConnection();con.setRequestMethod("GET");BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));String inputLine;StringBuffer response = new StringBuffer();while ((inputLine = in.readLine()) != null) {response.append(inputLine);}in.close();System.out.println(response.toString());} catch (Exception e) {System.out.println(e);}}}