當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twitter::GetFollowers方法代碼示例

本文整理匯總了PHP中Twitter::GetFollowers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::GetFollowers方法的具體用法?PHP Twitter::GetFollowers怎麽用?PHP Twitter::GetFollowers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Twitter的用法示例。


在下文中一共展示了Twitter::GetFollowers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ini_set

ini_set('memory_limit', -1);
require dirname(__FILE__) . '/../fx.php';
register_shutdown_function('ReleaseUser');
function ReleaseUser()
{
    User::Release();
}
$endtime = time() + 60 * 15;
while (time() < $endtime) {
    $sleep = true;
    $user = User::GetNext();
    if ($user !== false) {
        $update_started_at = time();
        $num_followers = 0;
        $followers = Twitter::GetFollowers($user['username']);
        if ($followers === false) {
            User::Update($user['username'], array('last_run_at' => time()));
            User::Release();
            continue;
        }
        foreach ($followers as $f) {
            //TwitterUsers::Add($f);
            Followers::Add($user['username'], $f);
        }
        $num_followers += count($followers);
        Followers::Remove($user['username'], $update_started_at);
        $updatedata = array('last_run_at' => time(), 'follower_count' => $num_followers);
        // If we haven't sent an email yet make sure we set the last time to the future
        // so we don't notify them of all their existing followers
        if ($user['last_email_at'] == 0) {
開發者ID:ntulip,項目名稱:TwitApps,代碼行數:30,代碼來源:get_follows.php

示例2: dirname

<?php

require dirname(__FILE__) . '/../fx.php';
while (@ob_end_clean()) {
}
$skipping = true;
$page = 1;
while ($page !== false) {
    $followers = Twitter::GetFollowers('ta_follows', $page);
    foreach ($followers as $f) {
        $exists = User::Exists($f['screen_name']);
        if ($exists or $skipping) {
            continue;
        }
        $skipping = false;
        $user = Twitter::Follow($headers['x-twittersenderscreenname']);
        if (User::Create($f)) {
            echo $f['screen_name'] . " created\n";
            Twitter::Tweet('d ' . $f['screen_name'] . ' Welcome to Follows from TwitApps. Send your email address by direct message to @ta_follows to activate this service.');
        } else {
            echo 'Failed to create user for ' . $f['screen_name'] . ': ' . mysql_error() . "\n";
        }
    }
    if (count($followers) == 100) {
        $page++;
    } else {
        $page = false;
    }
}
開發者ID:ntulip,項目名稱:TwitApps,代碼行數:29,代碼來源:catch_up_with_followers.php


注:本文中的Twitter::GetFollowers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。