# Want some information

**URL:** <https://rubytalk.org/t/want-some-information/53354>\
**Category:** ruby-talk\
**Created:** [12 May 2009 12:40 UTC](https://rubytalk.org/t/want-some-information/53354 "2009-05-12T12:40:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun\_Kumar2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Arun\_Kumar2](https://rubytalk.org/u/Arun_Kumar2)\
**Post date:** [12 May 2009 12:40 UTC](https://rubytalk.org/t/want-some-information/53354/1 "2009-05-12T12:40:52Z")

</div>

Hi,  
&nbsp;&nbsp;&nbsp;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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [12 May 2009 12:59 UTC](https://rubytalk.org/t/want-some-information/53354/2 "2009-05-12T12:59:04Z")

</div>

> 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

> **···**
>
> 2009/5/12 Arun Kumar \<arunkumar@innovaturelabs.com\>:
> 
> --  
> remember.guy do |as, often| as.you\_can - without end  
> [http://blog.rubybestpractices.com/](http://blog.rubybestpractices.com/)

---

<div class="post-metadata">

**Author:** ![Arun\_Kumar2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Arun\_Kumar2](https://rubytalk.org/u/Arun_Kumar2)\
**Post date:** [12 May 2009 13:06 UTC](https://rubytalk.org/t/want-some-information/53354/3 "2009-05-12T13:06:49Z")

</div>

Robert Klemme wrote:

> > � 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  
&nbsp;&nbsp;Thanks for the quick reply. Sorry for the impolite statement.

&nbsp;&nbsp;require 'net/http'

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

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

> **···**
>
> > 2009/5/12 Arun Kumar \<arunkumar@innovaturelabs.com\>:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Rick\_DeNatale1](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rick\_DeNatale1](https://rubytalk.org/u/Rick_DeNatale1)\
**Post date:** [12 May 2009 13:23 UTC](https://rubytalk.org/t/want-some-information/53354/4 "2009-05-12T13:23:46Z")

</div>

Well did you try it?

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

> **···**
>
> On Tue, May 12, 2009 at 9:06 AM, Arun Kumar \<arunkumar@innovaturelabs.com\> wrote:
> 
> > 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.
> 
> --  
> Rick DeNatale
> 
> Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
> Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
> WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
> LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![Arun\_Kumar2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Arun\_Kumar2](https://rubytalk.org/u/Arun_Kumar2)\
**Post date:** [13 May 2009 06:44 UTC](https://rubytalk.org/t/want-some-information/53354/5 "2009-05-13T06:44:09Z")

</div>

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,  
> &nbsp;&nbsp;&nbsp;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  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
