How to imitate a browser?

M

Marek Osvald

Hey guys,

so I'm trying to write a simple script for extraction of my profile data
from one site. In order to get the data I have to log in and then
download a page.

At first I tried to use Ruby's Net::HTTP library, but the problem is
that the site runs PHP and logs users in via storing cookies (therefore
the low-level network approach doesn't work).

Any ideas?
 
J

Jesús Gabriel y Galán

Hey guys,

so I'm trying to write a simple script for extraction of my profile data
from one site. In order to get the data I have to log in and then
download a page.

At first I tried to use Ruby's Net::HTTP library, but the problem is
that the site runs PHP and logs users in via storing cookies (therefore
the low-level network approach doesn't work).

Any ideas?

Use Mechanize:

http://mechanize.rubyforge.org/mechanize/

It manages cookies and allows you to fill forms, click links and so on.

Jesus.
 
A

Adriano Ferreira

[Note: parts of this message were removed to make it a legal post.]

Hi Marek,

Have you tried the combo Nokogiri (http://nokogiri.org/) / Mechanize
(http://mechanize.rubyforge.org/mechanize/) to do the job?

I recommend you to take a look at:
* http://railscasts.com/episodes/190-screen-scraping-with-nokogiri
* http://railscasts.com/episodes/191-mechanize
Adriano



________________________________
From: Marek Osvald <[email protected]>
To: ruby-talk ML <[email protected]>
Sent: Sun, October 3, 2010 11:28:38 AM
Subject: How to imitate a browser?

Hey guys,

so I'm trying to write a simple script for extraction of my profile data
from one site. In order to get the data I have to log in and then
download a page.

At first I tried to use Ruby's Net::HTTP library, but the problem is
that the site runs PHP and logs users in via storing cookies (therefore
the low-level network approach doesn't work).

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top