function ViewCommonFollower($id) { $follower2_dao = new Follower2_dao(); $follower2 = $follower2_dao->getById($id); $following_dao = new Following_dao(); $follower_dao = new Follower_dao(); foreach ($follower2 as $fol2) { $count = 0; $id2 = $fol2->id2; $follower = $follower_dao->getAll(); foreach ($follower as $fol) { $id = $fol->id; if ($id2 == $id) { $following = $follower_dao->getById($fol2->id2); echo "<a href=\"https://twitter.com/{$following->screen_name}\" target=\"_BLANK\"><img src=\"{$following->profile_image_url}\" alt=\"{$following->name}\" title=\"{$following->name}\"></a>"; } } //echo "<br/>"; //echo $count; } }
$following->name = $name; $following->screen_name = $myname; $following->followers_count = $fol; $following->friends_count = $fri; $following->statuses_count = $status; $following->location = $place; $following->profile_image_url = $thumb; //echo $follower->id; $following_dao->add($following); } $following = ""; //menghapus objek following //get data follower dari following dan menyimpannya ke tabel follower2 $following_dao = new Following_dao(); $data = $following_dao->getAll(); $follower2_dao = new Follower2_dao(); $follower2_dao->deleteAll(); foreach ($data as $datum) { $followers_url = "http://api.twitter.com/1/statuses/followers/{$datum->id}.json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $followers_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $curlout = curl_exec($ch); curl_close($ch); $followers2 = json_decode($curlout, true); foreach ($followers2 as $myfollowers2) { $myname = $myfollowers2['screen_name']; $thumb = $myfollowers2['profile_image_url']; $fol = $myfollowers2['followers_count']; $fri = $myfollowers2['friends_count']; $name = $myfollowers2['name'];