Want more features on Pastebin? Sign Up, it's FREE!

random quote twitter

By: vir0e5 on May 8th, 2013  |  syntax: PHP  |  size: 1.45 KB  |  views: 360  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. //twitter_update.php
  3. require("twitteroauth/twitteroauth.php");
  4. session_start();
  5.         if(!empty($_SESSION['username'])){  
  6.                 $twitteroauth = new TwitterOAuth('YOUR_CONSUMER_KEY', 'YOUR_CONSUMER_SECRET', $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);  
  7.     }  
  8. $foto = $_SESSION['oauth_uid'];
  9. $home_timeline = $twitteroauth->get('statuses/home_timeline', array('count' => 1));  
  10. ?>
  11. <h2>Hello <?=(!empty($_SESSION['username']) ? '@' . $_SESSION['username'] : 'Guest'); ?></h2>
  12. <html>
  13. <head>
  14. <title><?=(!empty($_SESSION['username'])? $_SESSION['username'] : 'Guest'); ?></title>
  15. <link rel="stylesheet" href="style.css" type="text/css" media="screen, projection" />
  16. </head>
  17. <body>
  18.  
  19. <div id="form"><!--Start form-->
  20. <p>Twitter Handle: <a href="http://twitter.com/<?=$_SESSION['username']; ?>" target="_blank"><?=(!empty($_SESSION['username']) ? '@' . $_SESSION['username'] : 'Guest'); ?></a></p>
  21. <p>Profile Picture: <br /><?php echo "<img src='http://api.twitter.com/1/users/profile_image?size=bigger&user_id=$foto' />" ?><br /></p>
  22.  
  23. <?php
  24. $quote=file("kata.txt");
  25. $totalnumberofquotes=count($quote);
  26. $rdm=rand(1,$totalnumberofquotes);
  27. $twitter = new TwitterOAuth('YOUR_CONSUMER_KEY', 'YOUR_CONSUMER_SECRET', $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
  28. $twitter->host = "https://api.twitter.com/1/";
  29. $twitter->post('statuses/update', array('status' => $quote[$rdm]));
  30. echo "[" .($quote[$rdm]). "]";
  31. ?>
  32. </div>
  33. </body>
  34. </html>
clone this paste RAW Paste Data