第一份工作就是写接口的~_(:з」∠)_
过程中找到的一些免费接口,挺好用的ლ(╹◡╹ლ)
java里的用法(其实根本没必要ti)~当然浏览器直接用可以~
public static void main(String[] args) {
String city = "广州";
String urlStr = "http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&day=0&city=" + city + "&dfc=1";
URL url = null;
BufferedReader in = null;
StringBuffer str = new StringBuffer();
try {
url = new URL(urlStr);
in = new BufferedReader(new InputStreamReader(url.openStream(), "GBK"));
String s = null;
while((s = in.readLine()) != null){
str.append(s);
}
} catch (Exception e) {
e.printStackTrace();
} finally{
try {
if(in != null){
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println(str.toString());
}
结果↓
(function(){var w=[];w['广州']=[{s1:'多云',s2:'多云',f1:'duoyun',f2:'duoyun',t1:'28',t2:'20',p1:'≤3',p2:'≤3',d1:'无持续风向',d2:'无持续风向'}];var add={now:'2015-03-20 15:07:38',time:'1426835258',update:'北京时间03月20日08:05更新',error:'0',total:'1'};window.SWther={w:w,add:add};})();//3
还有其他的接口~↓
物流快递接口
http://www.kuaidi100.com/query?type=快递公司代号&postid=快递单号
ps:快递公司编码:申通="shentong" EMS="ems" 顺丰="shunfeng" 圆通="yuantong" 中通="zhongtong" 韵达="yunda" 天天="tiantian" 汇通="huitongkuaidi" 全峰="quanfengkuaidi" 德邦="debangwuliu" 宅急送="zhaijisong"
气象局接口
http://m.weather.com.cn/data/城市代码.html(城市代码请看附件ლ(╹◡╹ლ))
多米音乐接口
http://v5.pc.duomi.com/search-ajaxsearch-searchall?kw=关键字&pi=页码&pz=每页音乐数
IP接口
新浪接口(ip值为空的时候 获取本地的) http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=218.4.255.255
淘宝接口 http://ip.taobao.com/service/getIpInfo.php?ip=63.223.108.42
手机信息查询接口
淘宝网接口
http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=手机号
拍拍接口
http://virtual.paipai.com/extinfo/GetMobileProductInfo?mobile=手机号&amount=10000&callname=getPhoneNumInfoExtCallback 用例
百付宝接口
https://www.baifubao.com/callback?cmd=1059&callback=phone&phone=手机号
115接口
http://cz.115.com/?ct=index&ac=get_mobile_local&callback=jsonp1333962541001&mobile=手机号
有道接口
http://www.youdao.com/smartresult-xml/search.s?jsFlag=true&type=mobile&q=手机号
手机在线接口
http://api.showji.com/Locating/www.showji.com.aspx?m=手机号&output=json&callback=querycallback
接口转至JSON在线工具:http://www.bejson.com/go.html?u=http://www.bejson.com/webInterface.html