/* New to 0.3 - Some people on super cheap hosting seem to get SQL errors - output them if they occur */ $db->output_error = 1; //Set cron status $cron->set_cron_state('follow', 1); //Get credentials $ap_creds = $db->get_ap_creds(); //Loop through all accounts $q1 = $db->query("SELECT * FROM " . DB_PREFIX . "authed_users ORDER BY (followers_count + friends_count) ASC"); while ($q1a = $db->fetch_array($q1)) { //Defines $connection = new TwitterOAuth($ap_creds['consumer_key'], $ap_creds['consumer_secret'], $q1a['oauth_token'], $q1a['oauth_token_secret']); $cron->set_user_id($q1a['id']); $cron->set_first_pass_done($q1a['fr_fw_fp']); $cron->set_log($q1a['log_data']); $cron->set_throttle_time(0, 'fr'); $cron->set_throttle_time(0, 'fw'); $cron->set_fr_fw_issue(0); //Refresh details $content = $connection->get('account/verify_credentials'); if ($connection->http_code == 200) { //Update DB $tw_user = array('id' => $q1a['id'], 'profile_image_url' => $content->profile_image_url, 'screen_name' => $content->screen_name, 'followers_count' => $content->followers_count, 'friends_count' => $content->friends_count, 'last_updated' => date("Y-m-d H:i:s")); $db->store_authed_user($tw_user); /* API Version 1.1 has really killed the limits here; from 350 per hour to 15 per 15 minutes. Also Follower and Friend lists are now separately rate limited; code adjusted below to set individual throttle rates. Thanks Twitter, real helpful (not).