- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
use LWP::Simple;
use HTML::FormatText;
use Fcntl ':flock';
use DB_File;
for ($num = 0 ; $num <= 1900; $num=$num+25){
$url = "http://btk-online.ru/phcode/?curPos1=&curPos="."$num";
print $url."\n";
my $file = "text_in.txt";
my $file_out = "text_out.txt";
$connect = get($url) ;
$text = HTML::FormatText->format_string($connect);
open(MYFILE, ">" .$file) or die "Can't create file: $!";
flock(MYFILE, LOCK_EX);
print MYFILE $text, "\n";
flock(MYFILE, LOCK_UN);
$tie = tie( my @lines, DB_File , $file , O_RDWR , 0666 , $DB_RECNO)
or die "Cannot tie file $file: $!\n";
for ( $line_number = 140; $line_number <= 317 ; $line_number++){
print $line_number "\n";
unless ( $line_number < $tie->length){
die "Didn't find line $line_number in $file \n";
}
open (YFILE, ">>" .$file_out) or die "Can't create file $! \n";
flock (YFILE, LOCK_EX);
print YFILE "$lines[$line_number-1] \n";
flock (YFILE, LOCK_UN);
}
}
Ребят ! Спасибо ! Едиственное быстро найденое средство перекинуть код с одной тачки на другую :)