在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1608|回复: 2

[讨论] sasa

[复制链接]
发表于 2011-12-14 22:15:49 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x









复制代码


#!perl
use warnings;
use strict;
use Data:umper;
use Win32::OLE qw( EVENTS );
my $time;
my $ie;
my $j = 0;
my $retry = 0;
my $url;
my @url;
$url[0]='http://bbs.eetop.cn/thread-252321-1-2.html?tid=252321&extra=page%3D2&page=1';
$url[1]='http://bbs.eetop.cn/thread-21237-1-1.html';
$url[2]='http://bbs.eetop.cn/thread-184738-1-1.html';
$url[3]='http://bbs.eetop.cn/thread-166743-1-1.html';
$url[4]='http://bbs.eetop.cn/thread-257214-1-1.html';
$url[5]='http://bbs.eetop.cn/thread-257342-1-1.html';
$url[6]='http://bbs.eetop.cn/thread-174228-1-2.html';
$url[7]='http://bbs.eetop.cn/thread-229120-1-1.html';
$url[8]='http://bbs.eetop.cn/thread-185924-1-1.html';
$url[9]='http://bbs.eetop.cn/thread-245737-1-2.html';
$url[10]='http://bbs.eetop.cn/thread-215741-1-1.html';
$url[11]='http://bbs.eetop.cn/thread-149597-1-1.html';
$url[12]='http://bbs.eetop.cn/thread-208954-1-1.html';
$url[13]='http://bbs.eetop.cn/thread-186966-1-1.html';
$url[14]='http://bbs.eetop.cn/thread-245737-1-1.html';
my @msg;
$msg[0]='我要信元,我要信元';
$msg[1]='灌灌更健康';
$msg[2]='一直灌~一直灌';
$msg[3]='为了10000不停灌!';
$msg[4]='哥为下载而来,灌水是我的风采。';
$msg[5]='大家赚才是真的赚,大家一起灌';
$msg[6]='先顶后看,养成习惯!!!!!';
$msg[7]='对不起,您两次发表间隔少于 60 秒,请不要灌水!';
$msg[8]='为了书夜以继日地灌水';
$msg[9]='灌水救中國';
$msg[10]='灌了个灌';
$msg[11]='灌的越多 赚的越多';
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
for (0..2000) {
   open LOG,'>>D:\private\skill\guanshui.txt' or die $!;
   $ie = Win32::OLE->new( 'InternetExplorer.Application' ) or die "error starting IE";
    #$ie = Win32::OLE->GetActiveObject('InternetExplorer.Application') || Win32::OLE->new('InternetExplorer.Application', 'Quit') or die "error starting IE";
    $ie->{visible} = 0;
    Win32::OLE->WithEvents( $ie, \&Event, 'DWebBrowserEvents2' );
    Win32::OLE->Option( Warn => 3 );
    $url = $url[int rand(@url)];
    $j ++;
    print LOG "==> $url\n";
    $ie->navigate($url);
    Win32::OLE->MessageLoop();
    $ie->Quit() if (defined $ie);
    undef $ie;
    close LOG;
    sleep 60;
}
sub Event
{
    my ($obj,$Event,@Args) = @_;
    my $IEObject = shift @Args;
    if ($Event eq 'DocumentComplete') {
        my $Doc = $IEObject->{Document};
if ( $Doc->{URL} eq $url ) {
            my $elem= $Doc->getElementById('fastpostmessage');
            my $form = $Doc->getElementById('fastpostform');
            if (! defined $form){
               $retry ++;
               if ($retry == 100) {
                  print LOG "ERROR: Already tried 10 times\n";
                  close LOG;
                  Win32::OLE->QuitMessageLoop();
                  # $ie->Quit() if (defined $ie);
                  # undef $ie;
                  die;
               }
               else{
                  print LOG "ERROR: Retry for the $retry time!\n";
                  close LOG;
                  Win32::OLE->QuitMessageLoop();
                  $ie->Quit() if (defined $ie);
                  undef $ie;
                  sleep 65;
                  next;
               }
            }
            $time = localtime();
            $elem->{value} = $msg[int rand(@msg)];
            $form->submit();
            print LOG "$j\t灌水成功 @ $time\n";     
            Win32::OLE->QuitMessageLoop();
        }
    }
    if ($Event eq "OnQuit"){
      Win32::OLE->QuitMessageLoop();
      print LOG "$j\tERROR: \$Event eq OnQuit happened!\n";
   }
}
 楼主| 发表于 2011-12-14 22:17:37 | 显示全部楼层
[code][/code]
#!perl
use warnings;
use strict;
use Data:umper;
use Win32::OLE qw( EVENTS );
my $time;
my $ie;
my $j = 0;
my $retry = 0;
my $url;
my @url;
$url[0]='http://bbs.eetop.cn/thread-252321-1-2.html?tid=252321&extra=page%3D2&page=1';
$url[1]='http://bbs.eetop.cn/thread-21237-1-1.html';
$url[2]='http://bbs.eetop.cn/thread-184738-1-1.html';
$url[3]='http://bbs.eetop.cn/thread-166743-1-1.html';
$url[4]='http://bbs.eetop.cn/thread-257214-1-1.html';
$url[5]='http://bbs.eetop.cn/thread-257342-1-1.html';
$url[6]='http://bbs.eetop.cn/thread-174228-1-2.html';
$url[7]='http://bbs.eetop.cn/thread-229120-1-1.html';
$url[8]='http://bbs.eetop.cn/thread-185924-1-1.html';
$url[9]='http://bbs.eetop.cn/thread-245737-1-2.html';
$url[10]='http://bbs.eetop.cn/thread-215741-1-1.html';
$url[11]='http://bbs.eetop.cn/thread-149597-1-1.html';
$url[12]='http://bbs.eetop.cn/thread-208954-1-1.html';
$url[13]='http://bbs.eetop.cn/thread-186966-1-1.html';
$url[14]='http://bbs.eetop.cn/thread-245737-1-1.html';
my @msg;
$msg[0]='我要信元,我要信元';
$msg[1]='灌灌更健康';
$msg[2]='一直灌~一直灌';
$msg[3]='为了10000不停灌!';
$msg[4]='哥为下载而来,灌水是我的风采。';
$msg[5]='大家赚才是真的赚,大家一起灌';
$msg[6]='先顶后看,养成习惯!!!!!';
$msg[7]='对不起,您两次发表间隔少于 60 秒,请不要灌水!';
$msg[8]='为了书夜以继日地灌水';
$msg[9]='灌水救中國';
$msg[10]='灌了个灌';
$msg[11]='灌的越多 赚的越多';
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
for (0..2000) {
   open LOG,'>>D:\private\skill\guanshui.txt' or die $!;
   $ie = Win32::OLE->new( 'InternetExplorer.Application' ) or die "error starting IE";
    #$ie = Win32::OLE->GetActiveObject('InternetExplorer.Application') || Win32::OLE->new('InternetExplorer.Application', 'Quit') or die "error starting IE";
    $ie->{visible} = 0;
    Win32::OLE->WithEvents( $ie, \&Event, 'DWebBrowserEvents2' );
    Win32::OLE->Option( Warn => 3 );
    $url = $url[int rand(@url)];
    $j ++;
    print LOG "==> $url\n";
    $ie->navigate($url);
    Win32::OLE->MessageLoop();
    $ie->Quit() if (defined $ie);
    undef $ie;
    close LOG;
    sleep 60;
}
sub Event
{
    my ($obj,$Event,@Args) = @_;
    my $IEObject = shift @Args;
    if ($Event eq 'DocumentComplete') {
        my $Doc = $IEObject->{Document};
if ( $Doc->{URL} eq $url ) {
            my $elem= $Doc->getElementById('fastpostmessage');
            my $form = $Doc->getElementById('fastpostform');
            if (! defined $form){
               $retry ++;
               if ($retry == 100) {
                  print LOG "ERROR: Already tried 10 times\n";
                  close LOG;
                  Win32::OLE->QuitMessageLoop();
                  # $ie->Quit() if (defined $ie);
                  # undef $ie;
                  die;
               }
               else{
                  print LOG "ERROR: Retry for the $retry time!\n";
                  close LOG;
                  Win32::OLE->QuitMessageLoop();
                  $ie->Quit() if (defined $ie);
                  undef $ie;
                  sleep 65;
                  next;
               }
            }
            $time = localtime();
            $elem->{value} = $msg[int rand(@msg)];
            $form->submit();
            print LOG "$j\t灌水成功 @ $time\n";     
            Win32::OLE->QuitMessageLoop();
        }
    }
    if ($Event eq "OnQuit"){
      Win32::OLE->QuitMessageLoop();
      print LOG "$j\tERROR: \$Event eq OnQuit happened!\n";
   }
}
 楼主| 发表于 2011-12-14 22:27:33 | 显示全部楼层
怎么用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-5 01:12 , Processed in 0.019872 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表