Guest User

Untitled

a guest
Jan 5th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <html>
  2.   <head>
  3.     <style>
  4.     .item {
  5.       float:none;
  6.       clear:both;
  7.       margin-top:1em;
  8.     }
  9.     .img {
  10.       float:left;
  11.       margin-right:1em;
  12.       padding-bottom: 10px;
  13.       height: 48px;
  14.       width: 48px;
  15.     }
  16.     </style>
  17.   </head>
  18.   <body>
  19.     <h2>Find Friends and Followers</h2>
  20.     <form method="get">
  21.       Find friends and followers of:
  22.       <input type="text" name="user" />
  23.     </form>
  24.  
  25.     <?php
  26.     if (isset($_GET['user'])) {
  27.       // load required library file
  28.       require_once('identica.lib.php');
  29.  
  30.       // set credentials
  31.       $username = 'nathanpc';
  32.       $password = 'nathan9019';
  33.  
  34.       // initialize service object
  35.       $service = new Identica($username, $password);
  36.  
  37.       // select user
  38.       $user = $_GET['user'];
  39.  
  40.       // get user's friends
  41.       $friends = simplexml_load_string($service->getFriends('xml', $user));
  42.  
  43.       // get user's followers
  44.       $followers = simplexml_load_string($service->getFollowers('xml', $user));
  45.  
  46.       if (count((array)$friends->user) > 0) {
  47.         echo '<h2>Friends</h2>';
  48.         foreach ($friends->user as $user) {
  49.             echo '<div class="item"><img src="' .
  50.               $user->profile_image_url . '" class="img" />';
  51.             echo $user->name . ' (@' . $user->screen_name . ')<br/>';
  52.             $status = (trim($user->status->text) != '')
  53.               ? $user->status->text : 'No status information';
  54.             echo '<em>' . $status . '</em></div>';
  55.         }
  56.       }
  57.  
  58.       if (count((array)$followers->user) > 0) {
  59.         echo '<h2>Followers</h2>';
  60.         foreach ($followers->user as $user) {
  61.             echo '<div class="item"><img src="' .
  62.               $user->profile_image_url . '" class="img" />';
  63.             echo $user->name . ' (@' . $user->screen_name . ')<br/>';
  64.             $status = (trim($user->status->text) != '')
  65.               ? $user->status->text : 'No status information';
  66.             echo '<em>' . $status . '</em></div>';
  67.         }
  68.       }
  69.  
  70.     }
  71.     ?>
  72.   </body>
  73. </html>
Add Comment
Please, Sign In to add comment