Forum: Ruby Want some information....

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
19eb75164135659a8fae98101b1c250e?d=identicon&s=25 Arun Kumar (arun_nss)
on 2009-05-12 14:40
Hi,
   I want to know about authentication in ruby. Is it possible to scrap
html of those sites which require basic authentication.

eg. I want to scrap the profile html page of a user. But in order to get
to that page I need to enter the username and password. Now if I'm using
'net/http' to scrap the contents of the profile page, how can I
implement the same. Is it possible in ruby to scrap web pages for which
the user need to enter the username and password.

Please help

N. B. - providing link to any documentation which states this problem
will be really helpfull.


Regards
Arun
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2009-05-12 15:00
(Received via mailing list)
2009/5/12 Arun Kumar <arunkumar@innovaturelabs.com>:
>   I want to know about authentication in ruby. Is it possible to scrap
> html of those sites which require basic authentication.

I am not a native speaker but for all I know "want" is considered
impolite among English speaking people.

> N. B. - providing link to any documentation which states this problem
> will be really helpfull.

What did your research turn up?  Did you check the standard library's
documentation in the well known place?

Regards

robert
19eb75164135659a8fae98101b1c250e?d=identicon&s=25 Arun Kumar (arun_nss)
on 2009-05-12 15:06
Robert Klemme wrote:
> 2009/5/12 Arun Kumar <arunkumar@innovaturelabs.com>:
>> � I want to know about authentication in ruby. Is it possible to scrap
>> html of those sites which require basic authentication.
>
> I am not a native speaker but for all I know "want" is considered
> impolite among English speaking people.
>
>> N. B. - providing link to any documentation which states this problem
>> will be really helpfull.
>
> What did your research turn up?  Did you check the standard library's
> documentation in the well known place?
>
> Regards
>
> robert

Hi
  Thanks for the quick reply. Sorry for the impolite statement.

  require 'net/http'

    Net::HTTP.start('www.example.com') {|http|
      req = Net::HTTP::Get.new('/secret-page.html')
      req.basic_auth 'account', 'password'
      response = http.request(req)
      print response.body
    }

This is the phrase which I got from the ruby-doc site. I dont know
whether this is helpfull or not. That's why I asked such a doubt. Please
give me a general guidance for this issue.

Thanks

Arun Kumar
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-05-12 15:24
(Received via mailing list)
On Tue, May 12, 2009 at 9:06 AM, Arun Kumar
<arunkumar@innovaturelabs.com> wrote:
>>
>  require 'net/http'
> give me a general guidance for this issue.
Well did you try it?

If it didn't work, did you make the correct substitutions for
'account' and 'password' ?


--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
19eb75164135659a8fae98101b1c250e?d=identicon&s=25 Arun Kumar (arun_nss)
on 2009-05-13 08:44
Rick Denatale wrote:
> On Tue, May 12, 2009 at 9:06 AM, Arun Kumar
> <arunkumar@innovaturelabs.com> wrote:
>>>
>>  require 'net/http'
>> give me a general guidance for this issue.
> Well did you try it?
Hi,
   Thanks for the reply.
Well, I didn't try it. I want to try it of course but before that I want
to know how such pages can be accessed. That's why I asked for some
guidance.

Arun
This topic is locked and can not be replied to.