DATA 전문가로 가는 길

[Perl] Perl 자동 화 설정 방법 본문

Programming/Perl

[Perl] Perl 자동 화 설정 방법

EstenPark 2010. 1. 13. 18:09
 #!/usr/bin/perl
 
use strict;
# Include the WWW::Mechanize module
use WWW::Mechanize;
use HTML::Entities; # +
use Encode;
#binmode(STDOUT, ':utf8'); # +

# What URL shall we retrieve?
my $url = "http://cafe.naver.com/joonggonara.cafe?iframe_url=/ArticleSearchList.nhn%3Fsearch.clubid=10050146%26search.searchdate=all%26search.searchtype=1%26search.query=%BE%C6%C0%CC%C6%CC%C5%CD%C4%A13%26search.sortby=date%26search.menuid=337";

# Create a new instance of WWW::Mechanize
my $mechanize = WWW::Mechanize->new(autocheck => 1);

# Retrieve the page
$mechanize->get($url);

# Retrieve the page title
my $title = $mechanize->title;

print "<b>$title</b><br />";


#my $res = $mechanize->submit_form(
#                    form_name = 'frmSearch',
#);                                

 my $content = encode('cp949',$mechanize->content);
                                          

print "$content \n";

# Place all of the links in an array
#my @links = $mechanize->links;


# Loop through and output each link
#foreach my $link (@links) {
#
#   # Retrieve the link URL
#   my $href = encode('cp949', $link->url);
#
#   # Retrieve the link text
#   my $name = encode('cp949', $link->text);
#   #my $name = $link->text;
#  
#   print "<a href=\"$href\">$name</a>\n";
#
#}



Comments