Feng Forum

Other Topics => Development => Community Contributions => : svenn July 06, 2010, 09:16:25 AM

: Dowload a particular version of a document or file using wget
: svenn July 06, 2010, 09:16:25 AM
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
: Re: Dowload a particular version of a document or file using wget
: cabeza 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.
: Re: Dowload a particular version of a document or file using wget
: svenn 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
:
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
:
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
: Re: Dowload a particular version of a document or file using wget
: cabeza July 08, 2010, 10:29:31 AM
Very interesting.
I think it opens a couple of doors for Feng Scripting.

Thank you!