Skip to content

Instantly share code, notes, and snippets.

@annguyendeveloper
Created July 3, 2018 11:39
Show Gist options
  • Save annguyendeveloper/a4cb218afe5983aaaaf3dc7c034b953c to your computer and use it in GitHub Desktop.
Save annguyendeveloper/a4cb218afe5983aaaaf3dc7c034b953c to your computer and use it in GitHub Desktop.
<?php
ini_set('max_execution_time', 0);
$token = "EAA..."; //token full quyền
$array_avoid = ["179034362668856","123"];//id trang không muốn bỏ thích, 179034362668856 là id trang J2TeaM
$array_pages = array();
$links = "https://graph.facebook.com/me/likes?fields=id&access_token=$token";
$curls = curl_init();
curl_setopt_array($curls, array(
CURLOPT_URL => $links,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
));
$reply = curl_exec($curls);
curl_close($curls);
$data = json_decode($reply,JSON_UNESCAPED_UNICODE);
$data = $data['data'];
foreach($data as $each){
$array_pages[] = $each['id'];
}
foreach($array_pages as $each){
if(!in_array($each,$array_avoid)){
$links = "https://graph.facebook.com/$each/likes?method=delete&access_token=$token";
$curls = curl_init();
curl_setopt_array($curls, array(
CURLOPT_URL => $links,
CURLOPT_RETURNTRANSFER => false,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
));
curl_exec($curls);
curl_close($curls);
sleep(3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment