Sunday, July 8, 2012

E-Mail Extractor php


E-Mail Extractor php

This post,I am going to extract email addresses in a web page and display then in a php file.I have taken a web page which have number of email addresses and saved it in my root directory.

Then created following php file to display the e mail addresses.

<?php
function extract_emails_from($string){
  preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
  return $matches[0];
}
$url =file_get_contents("index.html");
$emails = extract_emails_from($url);
print(implode($emails,"</br>"));
?>
abera@soka.edu
abera@soka.edu
mahn@soka.edu
mahn@soka.edu
rallinson@soka.edu
rallinson@soka.edu
asawa@soka.edu
asawa@soka.edu
sbarter@soka.edu
sbarter@soka.edu
ebayazian@soka.edu
ebayazian@soka.edu
mbennink@soka.edu
mbennink@soka.edu
hbhandari@soka.edu
hbhandari@soka.edu
rbhatt@soka.edu
rbhatt@soka.edu

1 comment:

  1. Manage your contacts and expenses with a program like Quickbooks bookkeeping software. Set up your program to keep track of expenses like ink, paper, photocopying, time spent on mock-up creations, client visits, outsourced work and any other expenses you incur. When it comes time to do your taxes, you might be amazed at how much you are allowed to deduct. Thanks a lot.
    Regards,
    Fitness Tips

    ReplyDelete