Extracting a part of a web page

I am making a campaign site for a client. On the site he want me to
reuse parts of exsisting webpages from his corporate site.
What I want to do is to extract a certain part from exsisting web page
and then inject that into my own template and serv it.
The content that I need to extract is inside a a named div, i.e.
everything inside

and the closing
.

Can anyone give me some pointers in the right direction?

/Jonas

On 9/2/06, jonbjo [email protected] wrote:

I am making a campaign site for a client. On the site he want me to
reuse parts of exsisting webpages from his corporate site.
What I want to do is to extract a certain part from exsisting web page
and then inject that into my own template and serv it.
The content that I need to extract is inside a a named div, i.e.
everything inside

and the closing
.

Can anyone give me some pointers in the right direction?

gem install hpricot --source code.whytheluckystiff.net

require ‘rubygems’
require ‘hpricot’
doc = Hpricot.parse(File.read(“index.html”))
doc.at(“div#maincontentBox”).inner_html

More information and examples are at:

/Jonas

Sincerely,

Tom L.
http://AllTom.com/
http://GadgetLife.org/