Java解析百度link?url

Java解析百度link?url

	/**
	 * @author 毛兴宇
	 * @param Java解析百度link?url http://blog.csdn.net/powmxypow
	 */
	public static void main(String[] args) {
		try {
			String str="http://www.baidu.com/link?url=0Fnlt86uqBcGsWpOaj58-d2rheFK6cbVeoE6oDF1tMYm-B5z1Q6h5RkVWGjYFk5M";
			URL url = new URL(str);
			HttpURLConnection conn=(HttpURLConnection)url.openConnection();
			conn.getResponseCode();
			String realUrl=conn.getURL().toString();
			conn.disconnect();
			System.out.println("真实URL:"+realUrl);
		} catch (MalformedURLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
	}


你可能感兴趣的:(java,百度,linkurl)