Quick question

W

wintermute

Hi,

Is there any way to remotely extract a page source with Ruby from a
website that uses session data?

Thank you,

W
 
A

Alex Young

wintermute said:
Hi,

Is there any way to remotely extract a page source with Ruby from a
website that uses session data?
Mechanize probably does what you're looking for.
 
K

Kyle Schmitt

Hum. Got me thinking, it's been awhile since I've used Net::HTTP, I
may have misspoken

So watir to html file
#only problem is it leaves an ie window hanging around, but it IS tiny :)
require 'watir'
File.open("/yea.html","w"){|f|
f.write(Watir::IE.start("http://news.google.com").html)}

Net::HTTP to html file
#just as small, easy and clean!
require 'net/http'
File.open("/yea.html","w"){|f|
f.write(Net::HTTP.get("news.google.com","/index.html"))}


Now the complexity comes when you want to navigate from page to page.
With Watir you do things like
@ie=Watir::IE.start(blah)
@ie.link:)text,/tofu/).click
Easy! And there is also firewatir which is a workalike for firefox
(haven't tried it myself)

NetHTTP is a bit more involved, but quite doable, and you don't need
windows or a gui or anything. Sadly I can't find the code I wrote
using it awhile ago.
Still lookie here, it's useful.
http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
 

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,240
Messages
2,571,211
Members
47,845
Latest member
vojosay

Latest Threads

Top