Tuesday, April 10, 2012

How to find the redirected URL of a URL?

URLConnection con = new URL( url ).openConnection();

System.out.println( "Original URL: " + con.getURL() );

con.connect();

System.out.println( "Connected URL: " + con.getURL() );

InputStream is = con.getInputStream();

System.out.println( "Redirected URL: " + con.getURL() );

No comments:

Post a Comment