Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- .item {
- float:none;
- clear:both;
- margin-top:1em;
- }
- .img {
- float:left;
- margin-right:1em;
- padding-bottom: 10px;
- height: 48px;
- width: 48px;
- }
- </style>
- </head>
- <body>
- <h2>Find Friends and Followers</h2>
- <form method="get">
- Find friends and followers of:
- <input type="text" name="user" />
- </form>
- <?php
- if (isset($_GET['user'])) {
- // load required library file
- require_once('identica.lib.php');
- // set credentials
- $username = 'nathanpc';
- $password = 'nathan9019';
- // initialize service object
- $service = new Identica($username, $password);
- // select user
- $user = $_GET['user'];
- // get user's friends
- $friends = simplexml_load_string($service->getFriends('xml', $user));
- // get user's followers
- $followers = simplexml_load_string($service->getFollowers('xml', $user));
- if (count((array)$friends->user) > 0) {
- echo '<h2>Friends</h2>';
- foreach ($friends->user as $user) {
- echo '<div class="item"><img src="' .
- $user->profile_image_url . '" class="img" />';
- echo $user->name . ' (@' . $user->screen_name . ')<br/>';
- $status = (trim($user->status->text) != '')
- ? $user->status->text : 'No status information';
- echo '<em>' . $status . '</em></div>';
- }
- }
- if (count((array)$followers->user) > 0) {
- echo '<h2>Followers</h2>';
- foreach ($followers->user as $user) {
- echo '<div class="item"><img src="' .
- $user->profile_image_url . '" class="img" />';
- echo $user->name . ' (@' . $user->screen_name . ')<br/>';
- $status = (trim($user->status->text) != '')
- ? $user->status->text : 'No status information';
- echo '<em>' . $status . '</em></div>';
- }
- }
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment