Skip to content

Instantly share code, notes, and snippets.

@geek-at
Last active November 1, 2022 03:02

Revisions

  1. geek-at revised this gist Apr 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion parse_austria.php
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    $a = explode(',',$line);
    $from = str_replace('"','',$a[0]);
    $to = str_replace('"','',$a[1]);
    for($i=$from;$i<$to;$i++)
    for($i=$from;$i<=$to;$i++)
    {
    $ip = long2ip($i);
    fwrite($fp,$ip."\n");
  2. geek-at created this gist Aug 21, 2018.
    25 changes: 25 additions & 0 deletions parse_austria.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <?php
    $infile = 'austria.csv';
    $outfile = 'austria.ips';

    $fp = fopen($outfile,'w');
    $handle = fopen($infile, "r");
    if ($handle)
    {
    while (($line = fgets($handle)) !== false) {
    $line = trim($line);
    $a = explode(',',$line);
    $from = str_replace('"','',$a[0]);
    $to = str_replace('"','',$a[1]);
    for($i=$from;$i<$to;$i++)
    {
    $ip = long2ip($i);
    fwrite($fp,$ip."\n");
    if(++$j % 10000==0)
    echo ".";
    }
    }

    fclose($handle);
    }
    fclose($fp);