Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can download all links in a web page with the extensions of pdf, zip, etc.

But one site has more than 50 links which ends like this: "http://... ... /showDocument.php?DocumentID=121" "http://... ... /showDocument.php?DocumentID=33" "http://... ... /showDocument.php?DocumentID=67"

When i copy links to my download program (Orbit) it can't understand that they are linked to pdf files. And downloads php files. How can i fix this and download all links easily? Thank you

share|improve this question
add comment

4 Answers

It may be a restriction of the program. Also, if you check, you probably won't see raw PHP in the file that downloads--it may be your PDF. Try changing the extension and see if you can open in in a PDF reader.

share|improve this answer
add comment

Web servers send back the type of file (known as a MIME Type) that you're downloading in HTTP headers, which most browsers uses to determine which application to use to open it with if it's not a file it can handle natively. This is how a browser knows that it needs to launch Word, or Excel, or Acrobat (or whatever) to open a file. I'm guessing Orbit just uses file extension instead. Since PHP code can be written to send back any kind of file type dynamically there's really no way to determine which file type is being downloaded simply by inspecting the file extension.

If this is the case, then it's a limitation of your downloader and you'll want to look for one that will inspect the file type based on the Content-Type HTTP header that is sent by the web server.

share|improve this answer
    
well downloader must not be orbit, it can be anything else that solves the problem. i didn't need to know file types as well. after downloading all, i can filter them by file type. –  trante Apr 14 '11 at 14:05
add comment

It could be that your program just uses a wrong filename, e.g. that the document is named "showDocument.php", but in reality it is a PDF --> try to rename it.

share|improve this answer
add comment

You could use wget.

#/bin/bash

for i in {0 .. 50} 
  do    
     wget http://... ... /showDocument.php?DocumentID=${i} 
  done

This assumes the 'numbers' are between 0 and 50. If they're random-ish numbers, then just make the upper bound for the for loop really high (ie 1000) and make wget ignore errors.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.