获取短链接后的真实url


1
2
3
4
5
6
7
String str="http://t.cn/Rvulay3";
URL url = new URL(str);
HttpURLConnection conn=(HttpURLConnection)url.openConnection();
conn.getResponseCode();
String realUrl=conn.getURL().toString();
conn.disconnect();
System.out.println("真实URL:"+realUrl);

结果>

1
http://gdown.baidu.com/data/wisegame/6c3d32d0d4274379/WeChat_462.apk

文章目录