Created
July 16, 2019 15:33
-
-
Save hypnguyen1209/170515392357d687b94ace54e19a5bb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
define('ID', ''); // ID bài viết | |
define('ACCESS_TOKEN', ''); // EAAA... | |
$followURL = "https://graph.facebook.com/me/subscribers?fields=id&limit=5000&access_token=".ACCESS_TOKEN; | |
$friendURL = "https://graph.facebook.com/fql?q=SELECT+uid+FROM+user+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+me())++ORDER+BY+rand()+LIMIT+5000&access_token=".ACCESS_TOKEN; | |
$commentURL = "https://graph.facebook.com/v3.3/".ID."/comments?fields=from,message&limit=5000&offset=0&access_token=".ACCESS_TOKEN; | |
function CURL($url) { | |
$ch = curl_init($url); | |
curl_setopt_array($ch, array( | |
CURLOPT_URL => $url, | |
CURLOPT_SSL_VERIFYPEER => false, | |
CURLOPT_SSL_VERIFYHOST => false, | |
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3833.0 Safari/537.36', | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_RETURNTRANSFER => true | |
)); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return $data; | |
} | |
$objectFollow = json_decode(CURL($followURL)); | |
for($j = 0; $j < count($objectFollow->data); $j++) { | |
$idFollow = $objectFollow->data[$j]->id; | |
file_put_contents('list.txt', $idFollow."\n", FILE_APPEND); | |
} | |
$objectFriend = json_decode(CURL($friendURL)); | |
for($k = 0; $k < count($objectFriend->data); $k++) { | |
$idFriend = $objectFriend->data[$k]->uid; | |
file_put_contents('list.txt', $idFriend."\n", FILE_APPEND); | |
} | |
$objectComment = json_decode(CURL($commentURL)); | |
for($i = 0; $i < count($objectComment->data); $i++) { | |
$id = $objectComment->data[$i]->from->id; | |
$comment = $objectComment->data[$i]->message; | |
if (strpos($comment, '@gmail.com') == true) { | |
if(strpos($comment, ' ' == true)){ | |
$array = explode(' ', $comment); | |
$email = $array[count($array)-1]; | |
}else{ | |
$email = $comment; | |
} | |
}else{ | |
$email = null; | |
} | |
$reponse = file_get_contents('http://localhost/list.txt'); | |
if (strpos($reponse, $id) == false) { | |
continue; | |
} | |
if ($email == null) { | |
echo $email; | |
}else{ | |
echo $email.'<br>'; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment