<html>
<head>
<title>Twitter-Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>Twitter-Test</h1>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input name="username" value="<?php echo $_POST['username']; ?>" />
<input type="submit" />
</form>
<p>
<?php
if (!empty ($_POST['username'])) {
$json = file_get_contents ("http://twitter.com/friends/ids/" . $_POST['username'] . ".json");
$friends = json_decode ($json);
$json = file_get_contents ("http://twitter.com/followers/ids/" . $_POST['username'] . ".json");
$followers = json_decode ($json);
$nofollowers = array_diff ($friends, $followers);
if (!empty ($nofollowers)) {
foreach ($nofollowers as $id) {
$json = file_get_contents ("http://twitter.com/users/show/" . $id . ".json");
$user = json_decode ($json);
?>
<a target="_new" href="http://twitter.com/<?php echo $user->screen_name; ?>"><?php echo $user->name; ?></a><br/>
<?php
}
}
}
?>
</p>
</body>
</html>