web page processing

P

Peder Ydalus

What would be the appropriate functions to:

1) Open an url and put the html in a variable.

2) Download a jpg from the above html and save it somewhere on disk.

Thanks!


- Peder -
 
A

A. Sinan Unur

What would be the appropriate functions to:

1) Open an url and put the html in a variable.

2) Download a jpg from the above html and save it somewhere on disk.

Check out LWP and HTML::parser, then share any difficulties you run into to
get help.
 
P

Peder Ydalus

Yep, I found out about LWP using perldoc.
I guess I can use get($picture_url) and save this to a file somewhere.


- Peder -
 
I

Iain Chalmers

Yep, I found out about LWP using perldoc.
I guess I can use get($picture_url) and save this to a file somewhere.

As you read a bit further through the documentation for LWP::Simple
(which is where I assume you read about get()), you'll come across the
getstore() function too :)

For beginners, the lwpcook doco ("The libwww-perl cookbook") explains a
lot of simple stuff very quickly. (type "perldoc lwpcook" at a prompt)

cheers,

big
 
T

Tore Aursand

1) Open an url and put the html in a variable.

use LWP::Simple;
my $html = get( $url );
if ( defined $html ) {
# HTML was downloaded OK
}
2) Download a jpg from the above html and save it somewhere on disk.

A bit more trickier, but still very easy with a lot of the modules out
there. The problem is that you might need to make absolute URLs out of
the links in the HTML you downloaded. The actual downloading is still
done with LWP::Simple's get() or getstore() functions.

Check out the HTML::LinkExtor documentation for a nice example on how to
extract links from HTML and make them absolute.
 
P

pkent

Peder Ydalus said:
What would be the appropriate functions to:

1) Open an url and put the html in a variable.
2) Download a jpg from the above html and save it somewhere on disk.

You'll be helped by the LWP::Simple module and HTML::LinkExtor

P
 

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

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,371
Latest member
Brkaa

Latest Threads

Top