Skip to content

Instantly share code, notes, and snippets.

@ammarfaizi2
Last active July 5, 2017 04:17
Show Gist options
  • Save ammarfaizi2/adffe28f82965ee679ec70cee08ece91 to your computer and use it in GitHub Desktop.
Save ammarfaizi2/adffe28f82965ee679ec70cee08ece91 to your computer and use it in GitHub Desktop.
<?php
$token = "EAABwzLixnjYBADjDljniFhK42p4lo..."; /*// your token ... */
$type = "LIKE"; /*// Select one LIKE, LOVE, WOW, HAHA, SAD, ANGRY, PRIDE (Deprecated) */
$ct = 2; /*// How many status ? ... */
class wq {
public function __invoke($token, $type, $ct)
{
$a = json_decode($this->exe("https://graph.facebook.com/me/home?access_token=".urlencode($token)."&fields=id&limit=".urlencode($ct)), true);
$a = $a['data'];
var_dump($a);
flush();
foreach (explode("\n", file_get_contents("token.txt")) as $token) {
foreach ($a as $aa) {
var_dump(json_encode(json_decode($this->exe("https://graph.facebook.com/".$aa['id']."/reactions", array(
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(
"type" => $type,
"access_token" => $token,
"method" => "POST"
)
))))."\n\n");
flush();
}
}
}
private function exe($a, $opt = null)
{
$ch = curl_init($a);
$op = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
);
if (is_array($opt)) {
foreach ($opt as $key => $value) {
$op[$key] = $value;
}
}
curl_setopt_array($ch, $op);
$out = curl_exec($ch);
$err = curl_error($ch) and $out = $err;
curl_close($ch);
return $out;
}
}
$a = new wq();
$a($token, $type, $ct);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment