1

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

4 Answers 4

1

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.

0

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.

1
  • 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, 2011 at 14:05
0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .