请求地址
String str = "https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?v=6.0&type=jsonp&data=%7B%22itemNumId%22%3A%22571151905544%22%2C%22exParams%22%3A%22%7B%5C%22id%5C%22%3A%5C%22571597818260%5C%22%7D%22%2C%22detail_v%22%3A%223.1.1%22%2C%22ttid%22%3A%222018%40taobao_iphone_9.9.9%22%2C%22utdid%22%3A%22123123123123123%22%7D";
通过代码
InputStream is = new URL(str).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
String jsonText = sb.toString();
System.out.println(jsonText);
} catch (IOException e) {
e.printStackTrace();
}
可以返回正常的请求数据,但用
Response resp = Http.get(str);
返回授权异常,nutz是有什么特殊处理么?