Sarsamkar, Paryushan:
Hi,

I have a URL, which displays different content at different time. Now I
want to save the page as html page to a particular location. How can I
do that using perl?


I once did the same stuff, so I share the script to you.

sub get_web {
    my $url = shift;
    my $timeout = 35;

    chdir "/data/wget";

    eval {
        local $SIG{ALRM} = sub {die "timeout!\n"};
        alarm $timeout;

        system("wget -p -q $url");

        alarm 0;
    };

    if ($@) {
        system("killall -9 wget");
    }
}


We use "wget -p" to get the page and its full dependency.
You could also use LWP but that's complicated to fetch the page and all its dependency.

Jeff.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to