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.

On 13 October 2011 11:16, merbivore [email protected] wrote:

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

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

Please help me. I was struck with this issue.


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


gplus.to/clanlaw

On Thu, Oct 13, 2011 at 05:14, merbivore [email protected] wrote:

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


LOOKING FOR WORK, preferably Ruby on Rails, in NoVa/DC; see main web
site.
Main Web S.: davearonson.com
Programming Blog: codosaur.us
Excellence Blog: dare2xl.com

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

try
exec i think