How to download the real file that was redirected using WordPress download-monitor plugin?

What I’m doing is using Jsoup to parse download url that is in the form of WordPress download-monitor url.
Example: http://**.com/wp-content/plugins/download-monitor/download.php?id=11036 when you click this link it will open a new download-page which use the id 11036 to download the real file.

My question is how can I bypass that download-monitor plugin and get the real file url instead?

Read More

Update 1:
here is the java code use to redirect.

<script type="text/javascript">
console.log(location.href);
var hasAutoDonload = false;
var address;
if(location.href.indexOf("d3") > 0){
address = "http://d3.apknew.com/download.php" + window.location.href.replace("http://apknew.com/download-page","");
}else{
address = "http://d2.apknew.com/download.php" + window.location.href.replace("http://apknew.com/download-page","");
}
var hasTouch = 'ontouchstart' in window;
window.onload = function(){
if(!hasAutoDonload){
downloadFun();
}
}
function downloadFun(){
hasAutoDonload = true;
if(hasTouch){
window.location.href = address;
}else{
document.getElementById("downloadIframe").src = address;
}
}
function downloadFun1(){
window.open(address)
}
//http://d2.apknew.com/download.php?i=er59f9t&n=QuickPic_2.0%20beta.apk&d=2012-02
</script>

Related posts

Leave a Reply

1 comment

  1. java.lang.CharSequence uri = "<your_url>";
    java.net.URL url = new java.net.URL(uri.toString());
    java.net.HttpURLConnection httpURLConnection = (java.net.HttpURLConnection) url.openConnection();
    httpURLConnection.setInstanceFollowRedirects(false);
    httpURLConnection.connect();
    int responseCode = httpURLConnection.getResponseCode();
    Log.i("Response Code", responseCode);
    String header = httpURLConnection.getHeaderField("Location");
    Log.i("Final URL", header);
    

    Over here, the final URL is stored in header. Make sure you include the protocol in the URL you provide. Also, I’ve tested this with 301 redirects. Not sure if it will work with javascript or other redirects.