Zubrag.com
October 22, 2019, 11:08:11 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Email extractor PHP snippet  (Read 3994 times)
SlovenianBoy
Newbie
*
Posts: 5


« on: January 18, 2008, 04:37:27 PM »

I found this snippet. Maybe woud be useful to modify it, so it extract emails from file_where_emails_are.txt and save it to  extracted_emails.txt (i use thatfore java script with combination with php based mass-mailer in one of my scripts - dating)

Code:
<?php

function extract_emails_from($string){
  
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i"$string$matches);
  return 
$matches[0];
}

$text "blah blah blah email@address.com blah blah blah email2@address.com";

$emails extract_emails_from($text);

print(
implode("\n"$emails));

?>

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC