# Want some information

**URL:** <https://www.ruby-forum.com/t/want-some-information/167782>\
**Category:** Ruby\
**Created:** [May 12, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/want-some-information/167782 "2009-05-12T14:40:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 12, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/want-some-information/167782/1 "2009-05-12T14:40:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 12, 2009, 3:00pm UTC](https://www.ruby-forum.com/t/want-some-information/167782/2 "2009-05-12T15:00:12Z")

</div>

2009/5/12 Arun K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 12, 2009, 3:06pm UTC](https://www.ruby-forum.com/t/want-some-information/167782/3 "2009-05-12T15:06:47Z")

</div>

Robert K. wrote:

> 2009/5/12 Arun K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > ï¿½ 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 K.

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 12, 2009, 3:24pm UTC](https://www.ruby-forum.com/t/want-some-information/167782/4 "2009-05-12T15:24:56Z")

</div>

On Tue, May 12, 2009 at 9:06 AM, Arun K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](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:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [May 13, 2009, 8:44am UTC](https://www.ruby-forum.com/t/want-some-information/167782/5 "2009-05-13T08:44:05Z")

</div>

Rick Denatale wrote:

> On Tue, May 12, 2009 at 9:06 AM, Arun K.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
