Skip to content

Instantly share code, notes, and snippets.

@ivikramsahu
Created September 10, 2020 16:45
Show Gist options
  • Save ivikramsahu/31fdc161898c8b1098e010003a92ca0a to your computer and use it in GitHub Desktop.
Save ivikramsahu/31fdc161898c8b1098e010003a92ca0a to your computer and use it in GitHub Desktop.

Revisions

  1. ivikramsahu created this gist Sep 10, 2020.
    14 changes: 14 additions & 0 deletions read-file.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php
    $fh = fopen('domain-push-to-ehr.csv','r');
    while($line = fgets($fh)){
    $string = trim(preg_replace('/\s\s+/', '', $line));
    $file = $string."_data.txt";
    if (filter_var("$string", FILTER_VALIDATE_IP)) {
    echo("$string is valid IP")
    continue;
    } else {
    echo("$string is not a valid IP address");
    }
    }
    fclose($fh);
    ?>