[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

regexp html scraping

Arun Kumar

3/18/2009 5:53:00 AM

Hi,
I've to extract the full html from a website url using regular
expressions or 'net-http'. Can anybody help me with the code to extract
the full html content of a website. I need to use only regexp or
'net:http'

Thanks
Arun Kumar
--
Posted via http://www.ruby-....

2 Answers

7stud --

3/18/2009 9:39:00 AM

0

Arun Kumar wrote:
> Hi,
> I've to extract the full html from a website url using regular
> expressions or 'net-http'. Can anybody help me with the code to extract
> the full html content of a website. I need to use only regexp or
> 'net:http'
>

require 'net/http'

Net::HTTP.start("www.google.com") do |http|
resp = http.get("/")
puts resp.body[0..100]
end

--output:--
<html><head><meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"><title>Google</ti

--
Posted via http://www.ruby-....

Robert Klemme

3/18/2009 10:10:00 AM

0

2009/3/18 Arun Kumar <arunkumar@innovaturelabs.com>:
> I've to extract the full html from a website url using regular
> expressions or 'net-http'.

What kind of question is that? Use net-http OR regular expressions -
I mean, both serve totally different purposes. You cannot exchange
one for the other. You'll have difficulties to obtain the content
using regular expressions only...

Wondering...

robert

--
remember.guy do |as, often| as.you_can - without end