Hello @all,

I'm new here and I'm not quite familiar with programming for the
twitter-api (I know, not the best condition^^), but I hope there is
someone could help me out. Is it a bug, or what's up? I have no idea!
Mostly the script works without any probs, but every two days, there
appears a big and bad issue: Some (follower count) entries are the
same as before. I'm using a tiny script to get the follower count of
some twitter-accounts. Actually, there are 400 fixed twitter-accounts.
I know about the request limit, so I've splitted the request to only
100 accounts per hour. The script will be started automatically via
cronjob. I was inspired by this Wiki:
http://apiwiki.twitter.com/w/page/22554755/Twitter-REST-API-Method:-users%C2%A0show
So, I import the number of all follower with this script:

<?php
require_once ('connect_to_database.php');
$twid = array();
$twid['000'] = "Account1";
$twid['001'] = "Account2";
$twid['002'] = "Account3";
foreach ($twid as $k => $twittername) {
$twitter_api_url = "http://api.twitter.com/1/users/show.xml?
screen_name=$twittername";
$api = curl_init($twitter_api_url);
curl_setopt($api, CURLOPT_HEADER, 0);
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($api);
curl_close($api);
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
    $follower = $match[1];
}
if (preg_match('/statuses_count>(.*)</',$xml,$match2)!=0) {
    $tweets = $match2[1];
}
if (preg_match('/name>(.*)</',$xml,$match3)!=0) {
    $name = $match3[1];
}

$update = "UPDATE databasetable SET Twitter_Name='".$name."',
Twitter_Follower='".$follower."', Twitter_Tweets='".$tweets."',
Twitter_Link='http://www.twitter.com/".$benutzername.";' WHERE ID = ".
$k."";
if ($follower !== "") {
$update = mysql_query($update);
}
}
mysql_close($connection);
?>

The BIG problem is, that there are entries, which are totally wrong
AND have the same entry (follower number) of the twitter-account the
script requested before. So, of 400 accounts, there are (every two
days) around 50 (in sequence, but with no regularity, and every time
other accounts), which are completly wrong.

On the wiki-page they say: "The notifications and following attributes
will be removed in version 2 of the API. Use /friendships/show or /
friendships/exists instead". BUT it IS still working (for the most
accounts), and these two alternatives give no answer about the
follower count. What do I wrong? Is there an alternative to my script?
Maybe with API 2 and oAuth?

I am at one's wits' end.

Regards
Sebastian

-- 
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