php 2 perl [need help]

Discussion in 'PHP' started by guest3297, 1 Feb 2007.

  1. guest3297

    guest3297 Banned

    Joined:
    27 Jun 2006
    Messages:
    1,246
    Likes Received:
    639
    Reputations:
    817
    так как перл я вообще не знаю помогите итерпритировать исходник под perl.
    PHP:
    <?
    $url "https://sie.com/index.php?s=test&pg=222&joinpage=../../../../../www/logs/";
    $folder "files";

    set_time_limit(0);
    for (
    $date=20050101;$date<20050131;$date++){
    $file = @file_get_contents($url."ts_cascade_log.".$date);
    if (
    strlen($file)>1){
    $file_write fopen($folder."/ts_cascade_log.".$date"w");
    fwrite($file_write$file);
    fclose($file_write);
    echo 
    "log.$date finish!/n/n, ";
    flush();
    }

    }
    ?>
    Спасибо.
     
  2. Digimortal

    Digimortal Banned

    Joined:
    22 Aug 2006
    Messages:
    471
    Likes Received:
    248
    Reputations:
    189
    примерно так:
    Code:
    #!/usr/bin/perl -w
    
    use LWP::Simple;
    
    my $url='https://sie.com/index.php?s=test&pg=222&joinpage=../../../../../www/logs/';
    
    for (20050101..20050131) {
    	my $cont=get $url."ts_cascade_log.".$_;
    	if ($cont){
    	open my $file, ">ts_cascade_log.$_"; 
    	print $file $cont ;
    	close $file;
    print "ts_cascade_log.$_ finished\n";}}
    понадобится модуль Crypt::SSLeay, чтоб работало при ssl..
     
    #2 Digimortal, 1 Feb 2007
    Last edited: 1 Feb 2007
    1 person likes this.