This is due to cloudfair protecting the site , file get contents does not set a user agent ect so is flagged by cloudfair we need to accept cookies also.
Using curl we can bypass this though..
Code:
<?php
function FuckOffCloudFair($url) {
$ch = curl_init();
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_COOKIEJAR, './cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, './cookies.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$html = FuckOffCloudFair('https://leakforums.net/bans.php?pq=1');
$pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $html, $matches);
foreach($matches[0] as $emailaddress){
$message = "hello";
mail($emailaddress, 'Subject', $message);
print "Sent email to " . $emailaddress . "<BR>";
}
?>
Gives us:
If I was you I would insert each email address to a mysql database with a unique column on the addreess , then check the mysql database using a SELECT/num_rows statement to see if a email is already there before emailing the person. This will prevent you emailing the same person twice.
P.S this might attract a bunch of scammers to any forum you are directing people too , so just keep that in mind!