웹페이지 긁어오기 예제
programming/perl 2010. 4. 9. 13:12 |use LWP::UserAgent;
$ua = LWP::UserAgent->new;
require HTTP::Request;
require HTTP::Response;
$i=1;
while($i<646)
{
$qu = 'http://server/index.asp?page='.$i;
$req = HTTP::Request->new(GET => $qu);
$res = $ua->request($req);
$filename = 'page'.$i.'.html';
open(FILE,"> $filename") || die "file open error\n";
print FILE $res->content;
close(FILE);
print $i."page success\n";
$i=$i+1;
}
$ua = LWP::UserAgent->new;
require HTTP::Request;
require HTTP::Response;
$i=1;
while($i<646)
{
$qu = 'http://server/index.asp?page='.$i;
$req = HTTP::Request->new(GET => $qu);
$res = $ua->request($req);
$filename = 'page'.$i.'.html';
open(FILE,"> $filename") || die "file open error\n";
print FILE $res->content;
close(FILE);
print $i."page success\n";
$i=$i+1;
}
'programming > perl' 카테고리의 다른 글
tcp request (0) | 2010.05.10 |
---|---|
외부파일실행예제 (0) | 2010.04.28 |
HTTP 파일업로드(Perl) (0) | 2009.12.30 |
web login dictionary attack (0) | 2009.12.03 |
HTTP요청 스크립트(ActivePerl) form-data (0) | 2009.11.19 |