Advertisement
tobitaz

otolikecurl

Jul 28th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.09 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $dbname = "penggoda_a";
  4. $dbpass = "erin";
  5. $username = "penggoda_a";
  6. $token = $_POST["token"];
  7.  
  8. if($token != null)
  9. {
  10.  
  11.  //check token invalid
  12. $ch = curl_init("https://graph.facebook.com/me?access_token=".$token);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14. $sintoken = curl_exec($ch);
  15. curl_close($ch);
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  $intoken = strripos($sintoken, "OAuthException");
  23.  
  24.  if($intoken === false)
  25.  {
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.   //dapat data
  39.    $ch2 = curl_init("https://graph.facebook.com/me?access_token=".$token);
  40. curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
  41. $dpt = curl_exec($ch2);
  42. curl_close($ch2);
  43.    
  44.    
  45.    $id = json_decode($dpt);
  46.    $a = "a";
  47.    $ids = $id->id.$a;
  48.    
  49.   //data status id
  50.  
  51.  
  52. $ch3 = curl_init("https://graph.facebook.com/me/feed?fields=id,message&access_token=".$token);
  53. curl_setopt($ch3, CURLOPT_RETURNTRANSFER, true);
  54. $staid = curl_exec($ch3);
  55. curl_close($ch3);
  56.  
  57. $taz = json_decode($staid)->data;
  58.  
  59.  
  60.  
  61.   foreach($taz as $tetek)
  62.   {
  63.  
  64.   echo '<body style="background-color:black; width:100%;">
  65.        <center>
  66.        <div style="border:3px grey outset; background-color:grey; width:60%;">
  67.        <form action="" method="post">
  68.        <font color="red">STATUS:</font><font color="white">'.$tetek->message.'</font>
  69.        
  70.        <input type="hidden" name="token" value="'.$token.'">
  71.        <font color="white" style="float:left;">statusid:</font><input name="statusid" value="'.$tetek->id.'" style="float:left;">
  72.        
  73.       <input type="submit" style="float:right; border:3px red outset; color:white; background-color:red;" value="Autolike">
  74.        </form><br /></div><br />';
  75.   }
  76.  
  77.  
  78.    
  79.  
  80.   //mysql connect
  81.  
  82.    $konet = mysqli_connect($host, $username, $dbpass, $dbname);
  83.    if(!$konet)
  84.     {
  85.     die("cannot conect");
  86.     }
  87.    
  88.    
  89.    
  90.    $qui = "CREATE TABLE otolike(idfb CHAR(255), token CHAR(255))";
  91.    mysqli_query($konet, $qui);
  92.  
  93.  
  94.  
  95.  
  96.     $taz = mysqli_query($konet, "SELECT * FROM otolike");
  97.     while($tob = mysqli_fetch_array($taz))
  98.      {
  99.            $tes.=$tob["idfb"];
  100.      }
  101.  
  102.  //cek token ada atw x
  103.  
  104.  
  105.  
  106.  
  107.  
  108.    $cek = strripos($tes, $ids);
  109.     if($cek === false)
  110.     {
  111.    mysqli_query($konet, "INSERT INTO otolike(idfb, token) VALUES ('".$ids."', '".$token."')");
  112.    
  113.     }
  114.     else
  115.     {
  116.    mysqli_query($konet, "UPDATE otolike SET token='".$token."' WHERE idfb='".$ids."'");
  117.    
  118.     }
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. //html tekan otolike
  128.  
  129. $statusid = $_POST["statusid"];
  130.  
  131.  if($statusid != null)
  132.   {
  133.  
  134.  
  135.       $taz = mysqli_query($konet, "SELECT * FROM otolike");
  136.     while($tom = mysqli_fetch_array($taz))
  137.      {
  138.      $tut = $tom["token"];
  139.      $ch4 = curl_init('https://graph.facebook.com/'.$statusid.'/likes?method=post&access_token='.$tut);
  140. curl_setopt($ch4, CURLOPT_RETURNTRANSFER, true);
  141. $liking = curl_exec($ch4);
  142. curl_close($ch4);    
  143.  
  144.      }
  145.      
  146.    }
  147.    else
  148.    {
  149.    }
  150.    
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. //die
  162. }
  163.  else
  164.    {
  165.    die("lawak...token expired");
  166.   }
  167. }
  168. else
  169. {
  170. echo file_get_contents("html.txt");
  171. }
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement