多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > Learn Web.Crawling of Perl

Learn Web.Crawling of Perl

來源:程序員人生   發布時間:2015-03-11 08:03:31 閱讀次數:2420次
##### #Overview of Web.Crawling related modules. #Note that, below codes can not be executed just for overview intention. ##### #!/usr/bin/perl ##### #HTTP::Thin ##### use 5.12.1; use HTTP::Request::Common; use HTTP::Thin; say HTTP::Thin->new()->request(GET 'http://example.com')->as_string; ##### #HTTP:Tiny ##### use HTTP::Tiny; my $response = HTTP::Tiny->new->get('http://example.com/'); die "Failed! " unless $response->{success}; print "$response->{status} $response->{reason} "; while (my ($k, $v) = each %{$response->{headers}}) { for (ref $v eq 'ARRAY' ? @$v : $v) { print "$k: $_ "; } } print $response->{content} if length $response->{content}; #new $http = HTTP::Tiny->new{ %attrubutes }; #valid attributes include: #-agent #-cookie_jar #-default_headers #-local_address #-keep_alive #-max_redirect #-max_size #-https_proxy #-proxy #-no_proxy #-timeout #-verify_SSL #-SSL_options #get[head][put][post]delete $response = $http->get($url); $response = $http->get($url, \%options); $response = $http->head($url); #post_form $response = $http->post_form($url, $form_data); $response = $http->post_form($url, $form_data, \%options); #request $response = $http->request($method, $url); $response = $http->request($method, $url, \%options); $http->request('GET', 'http://user:pwd hk.mars@aol.com'); #or $http->request('GET', 'http://mars%40:pwd hk.mars@aol.com'); #www_form_urlencode $params = $http->www_form_urlencode( $data ); $response = $http->get("http://example.com/query?$params"); #SSL support SSL_options => { SSL_ca_file => $file_path, } #proxy support ##### #www::Mechanize # #Stateful programmatic web browsing, used for automating interaction with websites. ##### use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get( $url ); $mech->follow_link( n => 3 ); $mech->follow_link( text_regex => qr/download this/i ); $mech->follow_link( url => 'http://host.com/index.html' ); $mech->submit_form( form_number => 3, fields => { username => 'banana', passoword => 'lost-and-alone', } ); $mech->submit_form( form_name => 'search', fields => { query => 'pot of gold', }, button => 'search now' ); #testing web applications use Test::More; like( $mech->content(), qr/$expected/, "Got expected content" ); #page traverse $mech->back(); #finer control over page $mech->find_link( n => $number ); $mech->form_number( $number ); $mech->form_name( $name ); $mech->field( $name, $value ); $mech->set_fields( $field_values ); $mech->set_visible( @criteria ); $mech->click( $button ); #subclass of LWP::UserAgent, eg: $mech->add_header( $name =>$value ); #page-fecting methods #status methods #content-handling methods #link methods #image methods #form methods #field methods #miscellaneous methods #overridden LWP::UserAgent methods #inherited unchanced LWP::UserAgent methods #yeah now, it's easy to implement a spider project for future integration use.
Mars
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 一区二区高清视频在线观看 | 欧美精品一区二区三区观 | 在线免费激情视频 | 天码毛片一区二区三区入口 | 羞羞动漫免费看网站 | 久久精品亚洲一区二区 | 久久99一区 | 久草在线视频福利 | 日韩欧美一区二区不卡看片 | 亚洲精品一区二区久久 | 在线播放人成午夜免费视频 | 日韩啊v | 免费观看成人欧美1314www | 中国美女隐私无遮挡免费视频 | 欧美大片天天免费看视频 | 最新国产视频 | 羞羞网址 | 手机看片日韩国产一区二区 | 精品久久中文久久久 | 欧美孕妇xxxx做受欧美 | 私人午夜影院 | 国产福利一区二区精品免费 | 中国黄色毛片 大片 | 久久lu| xxxx性视频| 亚洲精品成人一区二区aⅴ 亚洲精品成人在线 | 日韩欧美中文字幕出 | 69视频在线免费观看 | 亚洲免费二区 | 亚洲国产精品久久日 | 成人亚州 | 亚洲最新永久观看在线 | 激情视频在线 | 2021天天躁夜夜躁狠狠躁 | 中文字幕15页 | 国产成+人欧美+综合在线观看 | 日本大片aa特黄 | 久久99精品久久久久久综合 | 精品国产一区二区三区19 | 在线亚洲精品 | 欧美成人午夜做爰视频在线观看 |