Using wget in Rails controller

Hi,

   I have a link and am getting the csv file when i do in the
terminal. I would like to do that in rails controller. I need the
authentication also.

Here is the link

   " wget --user=test --password=test https://demo.service-now.com/incident_list.do\?CSV"

Please help me. I was struck with this issue.

Guys some body please help me in this.

Guys some body please help me in this.

It is important to remember that one cannot necessarily expect a rapid
reply from a mailing list. At any time about one third of the
population of the world is asleep and another third is working. Of
the remaining third the vast majority know nothing of RoR or have
better things to do than monitor the list. Unfortunately that appears
to leave just you and me and I don't know the answer, other than to
suggest using system() or backticks which is probably not the best
way.

It is best to wait 24 hours before bumping a question.

Have you considered the fact that if you do this in the controller
then the user will not get a response from his action until the get
has completed and you do the next render?

Colin

try
exec i think

I have a link and am getting the csv file when i do in the terminal.

...

" wget --user=test --password=test https://demo.service-now.com/incident_list.do\?CSV"

If I grok in fullness, what you are asking is essentially "how do I
open a file by URL, in Ruby?" Googling "ruby open url" (sans quotes)
yields some promising hits. Summary: check out net::http, and
open-uri. I didn't read it in enough detail to see how it handles
authentication (if at all), but at least it's a starting point. Maybe
Googling "ruby open authenticated url" might be useful? I'll leave
that as an exercise for the reader. :wink:

-Dave

You can just execute any bash command by including command within ``
in your controller.
For example in your case
'wget --user=test --password=test https://demo.service-now.com/incident_list.do\?CSV'

Regards;
Kshitiz