Newbie daft as a brush question
duggie-belfast-pm at blackstar.co.uk
duggie-belfast-pm at blackstar.co.uk
Mon Jan 14 13:01:06 CST 2002
On (14/01/02 18:50), Dan _ wrote:
>
>
> I am new to perl and am trying to open an html document form the web
> using perl & DOS.
>
> open (netfile, "//www.kjh.com/webpage.html");
>
> doesnt seem to do anything, I know this is quite innaine, but I guess
> someone has to be the butt of the jokes
Hi Dan
You probably want to use something like LWP::Simple. It allows you to
fetch the contents of a web page so that you can then do things with it.
Here's a really short script to show you how it's used.
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
# store the contents of the page as $feed
my $feed = get('http://www.kjh.com/webpage.html') ||
die "Can't fetch that page :(\n";
# to write it to a file, you can do this:
open(NETFILE, "> netfile.html") || die "Can't open the output file!\n";
print NETFILE $feed;
close(OUT);
I hope this helps you out.
Thanks
Duggie
--
Your stars: Aquarius (Jan. 20 - Feb. 18)
Be careful what you wish for this week. You won't get it, regardless,
but it's always a good idea to be careful. (supplied by The Onion)
More information about the Belfast-pm
mailing list