I've been working on a large Twitter Metrics project for a while now but one vexing thing in this experiment is showing non-followers. It should be a simple task, but it hasn't been. Using sites like justunfollow and twitterkarma i've verified my following but not following back count to be 2,058. No matter how many times I run my software [In addition to shuffle() I have manually iterated through the entire follow list - if someone has a better method let me know please (API Rate Limiting :/).

So here is the disparity, my code shows 1,518 non-followers. sites designed to calculate this showed earlier today 2,058. A lot of things could be going wrong here, maybe someone can point me in the right direction. I'm using Abrahams PHP Twitter OAuth on PHP 5.3 w/ MYSQL:


DB:

CREATE TABLE `NonFollowers` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `UserID` int(11) NOT NULL,
  `Screenname` varchar(255) NOT NULL,
  `DateAdded` datetime NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `UserID` (`UserID`)
);

PHP:

        public function GetFollowing() {

                $method = 'friends/ids';
                $following = $this->connection->get($method);
                echo count($following);
                return $following;
        
        }

        public function StatisticsNonFollowers() {
                
                $Following = $this->GetFollowing();
                $NonFollowersInDB = $this->GetNonFollowers();
                
                shuffle($Following);
                
                $NonFollower = array();

                for ($i = 0; $i < count($Following); $i++) {

$parameters = array('source_id' => $this->myID, 'target_id' => $Following[$i]);
                        $method = 'friendships/show';
                        $FollowBack = $this->connection->get($method, 
$parameters);
                        $HTTP_Response = $this->connection->http_code;
                        if ($HTTP_Response != 200) {
                                die("Received HTTP response of 
{$HTTP_Response}");
                        }
                        
                        $FollowingBack = 
$FollowBack->relationship->target->following;
                        
                        if ($FollowingBack != 1) {
                                
                                $Screenname = 
$FollowBack->relationship->target->screen_name;
                                $ID = $Following[$i];
                                $NonFollowers[$i] = $ID;
                                $DateAdded = date("Y-m-d H:i:s");

$query = "INSERT IGNORE INTO NonFollowers (UserID, Screenname, DateAdded) VALUES ($ID, '$Screenname', '$DateAdded')";
                                $rows = $this->DB->insert_sql($query);

                        }
                        
                }
                
        }


...

Any help for discovering this disparity would be great helpful! Thanks in advance group.

- Slate.

--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to