0

how I can find valid email through php simple dom parser in HTML String. thank you fou your help.

I've this code

 $html = $this->file_get_contents_curl('domain.com');
 $content = str_get_html($html) or die('this is not a valid url');
 $email = $content->find('a');

 foreach ($email as $k => $v) {
 if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/', $v)) 
            {
                echo  $v->href;
            }

        }

but this doesn't work

user1739222
  • 89
  • 1
  • 6

1 Answers1

0

foreach($html->find('a') as $e) echo $e->href . '
';

You will get all the anchor tags. Then you have to work on it.