How To Get Email from Facebook by PHP direct on the website

Authors: CodeToday | Search Engine (Google, Bing) | Views: 722 | Posted: 04 AM: 09/14/2017

You know that facebook is the largest social network today with several billion members, getting email address directly from facebook is now more difficult so I will get emails from facebook through the google search engine. 

Next article How to Search Email Address Free on GoogleToday I will guide you how to get email from facebook. Actually the search is still the same as the previous one, but different in how the query from google.com.

https://www.google.com.vn/search?num=100&q=site:facebook.com+[your keyword]

Query command when searching for a particular website at google.com is site: website name, ex: site:facebook.com

HTML

<form action="" method="post" class="form-inline">
<div class="form-group">
<input type="text" name="keyword" id="keyword" value="<?=$_POST['keyword']?>" size="80" class="form-control" placeholder = "Enter keyword here ..." required/>
</div>
<div class="form-group">
<button class="btn btn-info" type="submit" name="submit"><i class="glyphicon glyphicon-search"></i> FaceBook Extract Email Now</button>
</div>
</form>

PHP Full Source Code

<?
if(isset($_POST['submit'])) {
	
	$url  = 'https://www.google.com/search?num=100&q=site:facebook.com+'.str_replace(' ','+',$_POST['keyword']);
	echo '<p><pre>'.$url.'</pre></p>';
	$data = curlGet($url);
	$res = preg_match_all("/[a-z0-9_-+][email protected][a-z0-9-]+.([a-z]{2,3})(?:.[a-z]{2})?/i",$data,$matches);// Filter Emails 
	if ($res) {			
		echo '<ul>';
			foreach(array_unique($matches[0]) as $email) {																
				echo '<li>'.$email.'</li>';																			
			}
		echo '</ul>';	
	}
}

function curlGet($url){
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
	curl_setopt($ch, CURLOPT_HTTPGET, 1 );
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION , 1 );
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION , 1 );
	curl_setopt($ch, CURLOPT_URL, $url );
	curl_setopt($ch, CURLOPT_REFERER, $ref );
	curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);     
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}
?>
After completing and running the above code, the result will display as below when searching for the keyword "ceo (email or contact)".
How To Get Email from Facebook by PHP direct on the website

Note: The email address search syntax you can refer to the previous post

If you have any questions, please leave a message below