快递查询 看快递网有没有提供可用的 API,如果没有可以用 curl 或其他相应技术提交带有定单号的POST数据,并分析返回的数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个很简单的 ,关键是订单和快递号谁维护,如果是自已,很简单的,查这个订单号的快递号和信息如果快递信息是快递公司维护的,一般而且,快递公司也应自已的业务号,你可查快递公司的业务号和信息订单号 ----快递公司----快递公司的业务号你根据快递公司给你的业务号,在后台查询该定单的快递信息(curl或其他),但后返给客户 有一个接口,不但能实现你所说的功能,还能直接在你自己的网站上就能显示出查询的结果,根本不用点链接跳转,当用户点击进入“我的订单”时就能直接看到订单的物流跟踪状况,就像淘宝的的物流跟踪一样:http://code.google.com/p/kuaidi-api/wiki/Open_API_API_URL。 现在拍拍也在用这个,这里可以看到拍拍使用的效果:http://www.kuaidi100.com/app/paipai.shtml实现起来也很简单:(1)向上述的接口提交请求,请求时带上快递公司、快递单号等参数就行;(2)获得结果,(3)解析结果,将结果显示出来以下是Java实例:URL url= new URL("http://api.kuaidi100.com/api?id=XXXX&com=tiantian&nu=11111&show=2&muti=1&order=desc"); URLConnection con=url.openConnection(); con.setAllowUserInteraction(false); InputStream urlStream = url.openStream(); String type = con.guessContentTypeFromStream(urlStream); String charSet=null; if (type == null) type = con.getContentType(); if (type == null || type.trim().length() == 0 || type.trim().indexOf("text/html") < 0) return ; if(type.indexOf("charset=") > 0) charSet = type.substring(type.indexOf("charset=") + 8); byte b[] = new byte[10000]; int numRead = urlStream.read(b); String content = new String(b, 0, numRead); while (numRead != -1) { numRead = urlStream.read(b); if (numRead != -1) { //String newContent = new String(b, 0, numRead); String newContent = new String(b, 0, numRead, charSet); content += newContent; } } //System.out.println("content:" + content); urlStream.close(); 新手的一个简单问题,在单页内传值。 头大,救急。socket编程的问题 用哪种数据库比较好(PHP+mysql做中转) php在win下模拟的多线程问题 搜索引擎下载 在window平台上 跑php+sqlserver会不会出问题 mysql奇怪问题?请多帮忙! 高分求助,如何在PHP多个页面间传递参数?? 如何做网上招生系统 PHP 【新手】 zend编译过的文件,用apahe发布有乱码 刚接触PHP,听很多人说框架?框架是什么啊?
如果快递信息是快递公司维护的,一般而且,快递公司也应自已的业务号,你可查快递公司的业务号和信息
订单号 ----快递公司----快递公司的业务号你根据快递公司给你的业务号,在后台查询该定单的快递信息(curl或其他),但后返给客户
现在拍拍也在用这个,这里可以看到拍拍使用的效果:http://www.kuaidi100.com/app/paipai.shtml实现起来也很简单:
(1)向上述的接口提交请求,请求时带上快递公司、快递单号等参数就行;
(2)获得结果,
(3)解析结果,将结果显示出来以下是Java实例:
URL url= new URL("http://api.kuaidi100.com/api?id=XXXX&com=tiantian&nu=11111&show=2&muti=1&order=desc");
URLConnection con=url.openConnection();
con.setAllowUserInteraction(false);
InputStream urlStream = url.openStream();
String type = con.guessContentTypeFromStream(urlStream);
String charSet=null;
if (type == null)
type = con.getContentType(); if (type == null || type.trim().length() == 0 || type.trim().indexOf("text/html") < 0)
return ; if(type.indexOf("charset=") > 0)
charSet = type.substring(type.indexOf("charset=") + 8); byte b[] = new byte[10000];
int numRead = urlStream.read(b);
String content = new String(b, 0, numRead);
while (numRead != -1) {
numRead = urlStream.read(b);
if (numRead != -1) {
//String newContent = new String(b, 0, numRead);
String newContent = new String(b, 0, numRead, charSet);
content += newContent;
}
}
//System.out.println("content:" + content);
urlStream.close();