Thursday, October 1, 2015

Write a Perl Script to download the source code of any website/Webpage

Write a Perl Script to download the source code of any website/Webpage.

#!c:\perl64\bin\perl.exe -w
use strict;
use warnings;
use LWP::Simple;
########################################################################
#This Script will download the complete source code of desired webpage/website
########################################################################

my $url = 'http://www.indoscopy.com/';
my $content = get $url;
die "Couldn't get $url" unless defined $content;
#system("explorer $url");
my $filePath = "F:\\Perl\\Perl\\indoscopy.txt";
open(FILE,">$filePath") or die "Couldn't open file,$!";
print FILE $content;
close(FILE);
print "Source code written in indoscopy.txt page";


No comments:

Post a Comment