Εδώ θα βρείτε έναν κώδικα σε php, που εμφανίζει όλους τους χρήστες που σας ακολουθούν…αλλά δεν τους ακολουθείτε εσείς.
Δεν εγγυώμαι τίποτα, ελπίζω να σας βοηθήσει.
(index.php):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Ο καλός ο follower</title>
</head>
<link rel="stylesheet" type="text/css" href="style.css" />
<body>
<div id='wrapper'>
<?php
$username = "twitterusername";
$password = "twitterpassword";
$login = $username.":".$password;
////////////////////////////////////////////////////////////////
$apicall= "http://twitter.com/followers/ids/".$username.".xml";
$tw = curl_init();
curl_setopt($tw, CURLOPT_URL, $apicall);
curl_setopt($tw, CURLOPT_USERPWD, $login);
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
$twi = curl_exec($tw);
curl_close($tw);
///////////////////////////////////////////////////////////////
$ids = new SimpleXMLElement($twi);
$noofollowers = count($ids);
$pages=ceil($noofollowers/100);
for ($pg = 1; $pg <= $pages; $pg++) {
$apicall= "http://twitter.com/statuses/followers.xml?page=".$pg;
$ftw = curl_init();
curl_setopt($ftw, CURLOPT_URL, $apicall);
curl_setopt($ftw, CURLOPT_USERPWD, $login);
curl_setopt($ftw, CURLOPT_RETURNTRANSFER, TRUE);
$twi = curl_exec($ftw);
$follower_list = new SimpleXMLElement($twi);
// Printing each follower that you don't follow!
foreach ($follower_list->user as $follower) {
if ($follower->following == "false") {
echo "<div id='user'>";
echo "<img src='".$follower->profile_image_url."'>";
echo "<a href='http://twitter.com/".$follower->screen_name."'>".$follower->screen_name."</a>";
echo "<div id='tweet'>".$follower->status->text."</div>";
echo "</div>";
}
}
curl_close($ftw);
}
?>
</div>
</body>
</html>
Και το Stylesheet(style.css):
#wrapper {
margin: 20px auto;
width: 936px;
}
#user {
float: left;
width: 300px;
height: 100px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
filter:alpha(opacity=80);
-moz-opacity: 0.8;
opacity: 0.8;
border: 1px solid #ccc;
margin: 5px 5px 5px 5px;
word-wrap: break-word;
background-image: url('bg.gif');
font-family:"Times New Roman",Georgia,Serif;
}
#tweet {
float: right;
margin-right:5px;
width: 230px;
height: 47px;
font-size: 9pt;
}
#user img{
width: 48px;
height: 48px;
margin: 5px 5px;
border: 1px solid #ccc;
float: left;
}
0 σχόλια:
Δημοσίευση σχολίου