[java]代码库/**
* 根据快递单号查询数据信息
* @param kuaidiNo
* @return
*/
public static String getExpressInfo(String kuaidiNo){
StringBuffer content = new StringBuffer();
String url_1 = "http://www.kuaidi100.com/autonumber/autoComNum?text="+kuaidiNo;
String response_1 = getResponse(url_1);
String response_2 ="";
ExpressEntity en = JSON.parseObject(response_1,ExpressEntity.class);
int size = en.getAuto().size();
if(size==0){
content.append("
抱歉,暂无查询记录!
请确保您输入了正确的快递单号!
");}else{
String comCode = en.getAuto().get(0).getComCode();
String url_2 = "http://www.kuaidi100.com/query?type="+comCode+"&postid="+kuaidiNo+"&id=1&valicode=&temp=0.4189816807753606";
response_2 = getResponse(url_2);//拿到快递100返回的 信息
}
return response_2;
}
[代码运行效果截图]
[源代码打包下载]
快递查询.rar(50积分)[26 次下载]