[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Download csv file from secure web site (https

Alice Gheorghiu

5/26/2009 11:19:00 PM

I am a newbie to Ruby and I created a script to process a file which I
am getting from my local directory. However, in order to obtain this
file, I do a manual login to a secure http site (https) which presents
me with a logon screen where I enter the username and password. After
successful authentication, I am presented with a download page which has
as extension a php page which has a download button to get the file.
After I download on my local Windows Vista machine, I use FileZilla to
place it on the linux server.
How can I automate this in Ruby with open-uri or other extension for
that matter that would enable me to authenticate and get the file
directly on my linux server?
Any insight/code-example will be deeply appreciated.
Thanks so much, -- Alice
--
Posted via http://www.ruby-....

5 Answers

Reid Thompson

5/26/2009 11:25:00 PM

0

Alice Gheorghiu wrote:
> I am a newbie to Ruby and I created a script to process a file which I
> am getting from my local directory. However, in order to obtain this
> file, I do a manual login to a secure http site (https) which presents
> me with a logon screen where I enter the username and password. After
> successful authentication, I am presented with a download page which has
> as extension a php page which has a download button to get the file.
> After I download on my local Windows Vista machine, I use FileZilla to
> place it on the linux server.
> How can I automate this in Ruby with open-uri or other extension for
> that matter that would enable me to authenticate and get the file
> directly on my linux server?
> Any insight/code-example will be deeply appreciated.
> Thanks so much, -- Alice

can you ssh/scp directly to the secure http site (https) from a command line on
the linux host?

If so, you should be able to setup a passwordless login for scp and get the file
via a cron'd job using scp (google ssh passwordless login)

$ scp user_name@secure.http.site:/path/to/file /path/to/download/to/filename



Alice Gheorghiu

5/27/2009 12:13:00 AM

0

Reid Thompson wrote:
> Alice Gheorghiu wrote:
>> directly on my linux server?
>> Any insight/code-example will be deeply appreciated.
>> Thanks so much, -- Alice
>
> can you ssh/scp directly to the secure http site (https) from a command
> line on
> the linux host?
$ scp user_name@secure.http.site:/path/to/file
/path/to/download/to/filename
Tried ssh and I am getting error as follows in the ssh command:
$ ssh username@https://www.desired_website.com/pageWLinkTo...
$ ssh: https://www.desired_website.com/pageWLinkTo...: Name or
service > not known
> If so, you should be able to setup a passwordless login for scp and get
> the file
> via a cron'd job using scp (google ssh passwordless login) - not possible yet
but maybe - I can ask the data provider to set our account up for
automatic
download?
--
Posted via http://www.ruby-....

Alice Gheorghiu

5/27/2009 4:05:00 PM

0

Alice Gheorghiu wrote:
> Reid Thompson wrote:
>> Alice Gheorghiu wrote:
>>> directly on my linux server?
>>> Any insight/code-example will be deeply appreciated.
>>> Thanks so much, -- Alice
>>
>> can you ssh/scp directly to the secure http site (https) from a command
>> line on
>> the linux host?
> $ scp user_name@secure.http.site:/path/to/file
> /path/to/download/to/filename
Tried ssh and I am getting error as follows in the ssh command:
$ ssh username@https://www.desired_website.com/pageWLinkTo...
$ ssh: https://www.desired_website.com/pageWLinkTo...: Name or
service not known
>> If so, you should be able to setup a passwordless login for scp and get
>> the file
>> via a cron'd job using scp (google ssh passwordless login)
- not possible yet but maybe - I can ask the data provider to set our
account up for automaticdownload?
I spoke with both data providers and they cannot help much. Any
suggestions of Ruby articles or sample code that may treat a similar
problem? Thanks again so very much.
--
Posted via http://www.ruby-....

Joel VanderWerf

5/27/2009 4:20:00 PM

0

Alice Gheorghiu wrote:
> Tried ssh and I am getting error as follows in the ssh command:
> $ ssh username@https://www.desired_website.com/pageWLinkTo...
> $ ssh: https://www.desired_website.com/pageWLinkTo...: Name or
> service not known

If it works at all, it would be something like:

ssh username@desired_website.com

but the fact that there is a https interface does not imply that there
is an ssh interface. They are handled by different server software, and
unless the provider explicitly set up an ssh server, it won't be there.
And for that matter, having an account on the https server doesn't imply
having an account that you can access via ssh, even if the ssh server is
running.

It sounds like a task for something like mechanize[1], but I don't know
how it is with https. Some others on this list will know, I hope... or
try googling for "ruby mechanize https".

[1] http://mechanize.rubyforge.org/...

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Alice Gheorghiu

5/27/2009 5:09:00 PM

0

Joel VanderWerf wrote:
> Alice Gheorghiu wrote:
Tried ssh and I am getting error as follows in the ssh command:
$ ssh username@https://www.desired_website.com/pageWLinkTo...
$ ssh: https://www.desired_website.com/pageWLinkTo...: Name or
service not known

> If it works at all, it would be something like:
> ssh username@desired_website.com

> but the fact that there is a https interface does not imply that there
> is an ssh interface. They are handled by different server software, and
> unless the provider explicitly set up an ssh server, it won't be there.
> And for that matter, having an account on the https server doesn't imply
> having an account that you can access via ssh, even if the ssh server is
> running.
>
> It sounds like a task for something like mechanize[1], but I don't know
> how it is with https. Some others on this list will know, I hope... or
> try googling for "ruby mechanize https".
> [1] http://mechanize.rubyforge.org/...
You are right, whereby their reluctance to assist. The site is a good
starting point. Will browse and will be back with the code if I can make
it work. Thanks a million.
--
Posted via http://www.ruby-....