GLADzTeguhID

Facebook Bot COPAS Berita

Oct 26th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. <?php
  2.  
  3. function getFeed($feed_url)
  4. {
  5.      $content = file_get_contents($feed_url);
  6.      $su = new SimpleXmlElement($content);
  7.  
  8. $day = $su->channel->item;
  9. $link = $day->link;
  10. $title = $day->title;
  11. $asuw = $day->enclosure;
  12. $des = $day->description.'<';
  13.  
  14. $toket = ('toket_semogg'); // Masukan Tosken mu . hapus file get c0ntent jika kamu menaruh langsung token nya
  15.  
  16. $pecah = explode('>',$des);
  17. $pecahin = explode('<',$pecah[1]);
  18. $bukak = $pecahin[0];
  19.  
  20. $judul = $title;
  21.  
  22. $url = "https://graph.facebook.com/me/feed?method=POST";
  23.      $ch = curl_init();
  24.  
  25.     $attachment =  array(   'access_token'  => $toket,
  26.             'link' => $link,
  27.             'picture' => $asuw,
  28.             'message' => $judul,
  29.             'name' => '',
  30.             'description' => '',
  31.             'from' => '',
  32.             'created_time' => '',
  33.                     );
  34.  
  35.     curl_setopt($ch, CURLOPT_URL,$url);
  36.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  37.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  38.     curl_setopt($ch, CURLOPT_POST, true);
  39.     curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
  40.     $result= curl_exec($ch);
  41.  
  42.     curl_close ($ch);
  43.  
  44.  
  45. print '
  46.         <li>
  47. <b>Simple bot berita</b> '.$title.' <br>
  48. -> Contact me :
  49.         <li>
  50.           <a href="http://facebook.com/djempoler">On facebook</a>
  51.         </li>';
  52.  
  53. }
  54. $detik_inet = "http://rss.detik.com/index.php/inet";
  55. $detik_sport = "http://rss.detik.com/index.php/sepakbola";
  56. $detik_hot = "http://rss.detik.com/index.php/hot";
  57. # $viva_tek = "http://rss.vivanews.com/get/teknologi";
  58. $viva_bola = "http://rss.vivanews.com/get/bola";
  59. $viva_all = "http://rss.vivanews.com/get/all";
  60.  
  61. $eyek = array($detik_inet,$detik_sport,$viva_all,$viva_bola);
  62. $acak = $eyek[rand(0,count($eyek)-1)];
  63. getFeed("".$acak."");
  64.  
  65. ?>
Add Comment
Please, Sign In to add comment