Skip to content

Instantly share code, notes, and snippets.

@dandyraka
Created May 26, 2018 18:20
Show Gist options
  • Save dandyraka/3ff9cd535d89bac2bcc8789b5672f046 to your computer and use it in GitHub Desktop.
Save dandyraka/3ff9cd535d89bac2bcc8789b5672f046 to your computer and use it in GitHub Desktop.
<?php
$token = "YOUR_TOKEN";
$md5 = md5(time());
$hash = substr($md5, 0, 8)."-".substr($md5, 8, 4)."-".substr($md5, 12, 4)."-".substr($md5, 16, 4)."-".substr($md5, 20, 12);
function curl($url, $post=null) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($post != null) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
$me = json_decode(curl("https://graph.facebook.com/me?fields=id&access_token=".$token));
if(!empty($me->id)) {
$var = "{\"0\":{\"is_shielded\":true,\"session_id\":\"$hash\",\"actor_id\":\"$me->id\",\"client_mutation_id\":\"$hash\"}}";
$hajar = json_decode(curl("https://graph.facebook.com/graphql", array(
"variables" => $var,
"doc_id" => "1477043292367183",
"query_name" => "IsShieldedSetMutation",
"strip_defaults" => "true",
"strip_nulls" => "true",
"locale" => "en_US",
"client_country_code" => "US",
"fb_api_req_friendly_name" => "IsShieldedSetMutation",
"fb_api_caller_class" => "IsShieldedSetMutation",
"access_token" => $token
)));
if(!empty($hajar->data->is_shielded_set->is_shielded)){
echo "Success";
} else {
echo "Failed";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment