Hi guys I am working in a download manager projetct.
I was testing some link and is working fine, however I found a problem
This two links below was from emupardise, I will be using then only to show my point.
If I use this code:
String GameLink = "http://www.emuparadise.me/roms/get-download.php?gid=43269&token=2f91d51fcd8b90cec75193ffd592f07c&mirror_available=true";
// String GameLink = "http://www.emuparadise.me/roms/get-download.php?gid=43270&token=a6f395885bea3bbef73d972804d2cbdb&mirror_available=true";
try {
URL url = new URL(GameLink);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Host" ,"www.emuparadise.me");
con.setRequestProperty("Accept" ,"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
con.setRequestProperty("Accept-Encoding" ,"gzip, deflate");
con.setRequestProperty("Referer" ,"www.emuparadise.me");
con.setRequestProperty("Connection" ,"keep-alive");
System.out.println("Server answer :"+ con.getResponseCode());
con.connect();
InputStream is = con.getInputStream();
System.out.println(con.getURL().toString()+"\n");
is.close();
} catch (IOException ex) {
Logger.getLogger(Question.class.getName()).log(Level.SEVERE, null, ex);
}
In the first I get:
"Server answer :200" (Like I want), however using the second link I get:
"Server answer :-1" and then I get the error: java.io.IOException: Invalid Http response
I already checked the header in both pages and they are the same, besides both links work in Internet Download Manager, can anyone please provide me a solution?
Thanks very much for your time