filter email addresses (in PHP)

Discussion in 'Programming/Scripts' started by edge, Jan 31, 2008.

  1. edge

    edge Active Member Moderator

    I have a list here with some email addresses that need to be "cleaned"
    The list is in a text file, and looks like this
    * the list does have more email addresses, and this is only an example.

    Now I need some PHP code to ONLY show all the email addresses from (and if needed only from or ect...)

    Someone here who can show me how this is done? (I guess it needs to make use of a wild card for the pre @ part)

    Thank you
  2. topdog

    topdog Active Member HowtoForge Supporter

    # [email protected]
    $file = "path_to_file";
    $domain = "";
            $x = fopen($file,"r");
                            $b = fgets($x, 4096);
                            if (eregi($domain, $b))
                                    print "$b\n";
            print "File $file does not exist";
  3. edge

    edge Active Member Moderator

    Thank you Andrew!

    I'll be testing your code later today.

Share This Page