读书人

哪位高手有调用过第三方的接口经验的

发布时间: 2013-06-26 14:29:32 作者: rapoo

谁有调用过第三方的接口经验的 来看看?
http://trac.meyoung.cn/Trac/wiki/public/mefp#%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F

谁给看看这个接口 怎么调用啊
我有测试用的帐号和key

QQ:
107566186


[解决办法]

public static String getResponseData(String url) throws Exception{
URL dataUrl = null;
String data = null;
try {
dataUrl = new URL(url);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
HttpURLConnection con = null;
try {
con = (HttpURLConnection) dataUrl.openConnection();
} catch (IOException e) {
e.printStackTrace();
}
con.setRequestMethod("GET");
con.setRequestProperty("Proxy-Connection", "Keep-Alive");
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
con.setRequestProperty("Charset", "utf-8");
con.setDoOutput(true);
con.setDoInput(true);

BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"utf-8"));
String line = "";
String result = "";
while(null != (line=br.readLine())){
result += line;
}
return result;
}

给你提供下参考

读书人网 >Java Web开发

热点推荐