Author Topic: Dowload a particular version of a document or file using wget  (Read 4584 times)

svenn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hi,
In a tool flow, I use Feng Office to write documentation and then download the html file and pass it through a script to extract commands to development tools. I am playing with wget  to do the download automatically from a Makefile before running the rest of the development tools.

In the revision list of the specification html document in FO I copy and paste the link from the download button of the document version I would like to download to wget on the command line:
wget -O "http://server/fengindex.php?c=files&a=download_revision&id=83" I also tried
wget -O "http://user:pass@server/fengindex.php?c=files&a=download_revision&id=83" but the html I download is only the code for the login screen.

Any idea what I do wrong?

Svenn

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Dowload a particular version of a document or file using wget
« Reply #1 on: July 07, 2010, 04:11:26 pm »
Never tried it, but I think you should first create a session by logging in. This is, request login page with certain POST parameters.
After that request the file revision URL directly.

svenn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Dowload a particular version of a document or file using wget
« Reply #2 on: July 08, 2010, 05:04:08 am »
cabeza, with your hints I managed to find a solution:

First get a cookie from the login and save to a file, in my case I call the file feng
Code: [Select]
wget -O - --save-cookies feng --post-data "login[username]=myname&login[password]=mypass" "http://server/feng/index.php?c=access&a=login" > /dev/null

Then I download the file using that cookie
Code: [Select]
wget -O test.html --load-cookies feng  "http://server/feng/index.php?c=files&a=download_file&id=18"

Since the username and password is clear text on the command line, I have to wrap it in a script in my multi-user environment, but that is a different story.

Thanks,
Svenn

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Dowload a particular version of a document or file using wget
« Reply #3 on: July 08, 2010, 10:29:31 am »
Very interesting.
I think it opens a couple of doors for Feng Scripting.

Thank you!