本文整理匯總了PHP中Twitter::GetUserDetails方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::GetUserDetails方法的具體用法?PHP Twitter::GetUserDetails怎麽用?PHP Twitter::GetUserDetails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::GetUserDetails方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
break;
}
$query = Followers::GetDiffs($user['username'], $user['last_email_at']);
$changes = array('new' => array(), 'old' => array());
if (empty($user['post_url'])) {
$body_text = TPL('emails/body_text_header', array('username' => $user['username'], 'last_email_at' => $user['last_email_at']), true);
$body_html = TPL('emails/body_html_header', array('username' => $user['username'], 'last_email_at' => $user['last_email_at']), true);
}
$currentlynew = 0;
$new_text = '';
$new_html = '';
$ex_text = '';
$ex_html = '';
while ($row = mysql_fetch_assoc($query)) {
// Update the user
$twitteruser = Twitter::GetUserDetails($row['follower_id'], 'user_id');
if (!$twitteruser or !$twitteruser->screen_name) {
continue;
}
// User not found, skip it
$userdata = array('username' => (string) $twitteruser->screen_name, 'description' => (string) $twitteruser->description, 'url' => (string) $twitteruser->url, 'name' => (string) $twitteruser->name, 'protected' => (int) $twitteruser->protected ? 1 : 0, 'followers_count' => (string) $twitteruser->followers_count, 'following_count' => (string) $twitteruser->friends_count, 'profile_image_url' => (string) $twitteruser->profile_image_url, 'location' => (string) $twitteruser->location);
TwitterUsers::Set($twitteruser->id, $twitteruser->screen_name, $userdata);
$row['username'] = $twitteruser->screen_name;
foreach ($userdata as $key => $value) {
$row[$key] = $value;
}
$counter++;
$row['last_email_at'] = $user['last_email_at'];
$new = ($row['unfollowed_at'] == 0 or $row['followed_at'] > $user['last_email_at']);
if ($new) {
if (empty($user['post_url'])) {
示例2: elseif
echo 'Follow failed for "' . $headers['x-twittersenderscreenname'] . '": ' . $user['error'] . "\n";
} elseif (stripos(@$user['error'], 'already on your list') !== false or User::Create($user)) {
Twitter::Tweet('d ' . $headers['x-twittersenderscreenname'] . ' Welcome to Replies from TwitApps. Send your email address by direct message to @' . $_twitter['username'] . ' to activate this service.');
} else {
echo 'Failed to create user "' . $headers['x-twittersenderscreenname'] . '": ' . mysql_error(GetDB()) . "\n";
}
break;
case 'direct_message':
// Direct message should contain a command or an email address
$body = imap_body($mbox, $msgid, FT_PEEK);
$email = false;
foreach (preg_split('/\\s/', strtolower($body)) as $word) {
switch ($word) {
case 'start':
//echo 'Start for "'.$headers['x-twittersenderscreenname'].'"'."\n";
$user = Twitter::GetUserDetails($headers['x-twittersenderscreenname']);
if ($user and User::SetStatus($headers['x-twittersenderscreenname'], 'active', $user->status->id)) {
$dm = 'Sorted! I\'ll start sending you emails again shortly.';
} else {
$dm = 'Grrr, something went wrong restarting your emails. I\'ve notified the team and they\'ll look into it ASAP.';
echo ' Failed to start emails for "' . $headers['x-twittersenderscreenname'] . '"' . "\n\n";
}
Twitter::Tweet('d ' . $headers['x-twittersenderscreenname'] . ' ' . $dm);
break;
case 'stop':
//echo 'Stop for "'.$headers['x-twittersenderscreenname'].'"'."\n";
if (User::SetStatus($headers['x-twittersenderscreenname'], 'inactive')) {
$dm = 'Ok, I\'ll stop sending you emails for now. Send the word "start" to restart them again.';
} else {
$dm = 'Grrr, something went wrong stopping your emails. I\'ve notified the team and they\'ll look into it ASAP.';
echo ' Failed to stop emails for "' . $headers['x-twittersenderscreenname'] . '"' . "\n\n";
示例3: elseif
if (isset($user['error']) and stripos($user['error'], 'already on your list') === false) {
echo 'Follow failed for "' . $info['headers']['x-twittersenderscreenname'] . '": ' . $user['error'] . "\n";
} elseif (stripos(@$user['error'], 'already on your list') !== false or User::Create(isset($user['screen_name']) ? $user : array('screen_name' => $info['headers']['x-twittersenderscreenname']))) {
Twitter::Tweet('d ' . $info['headers']['x-twittersenderscreenname'] . ' Welcome to Follows from TwitApps. Send your email address by direct message to @' . $_twitter['username'] . ' to activate this service.');
} else {
echo 'Failed to create user "' . $info['headers']['x-twittersenderscreenname'] . '": ' . mysql_error(GetDB()) . "\n";
}
break;
case 'direct_message':
// Direct message should contain a command or an email address
$email = false;
foreach (preg_split('/\\s/', strtolower($body)) as $word) {
switch ($word) {
case 'start':
//echo 'Start for "'.$info['headers']['x-twittersenderscreenname'].'"'."\n";
$user = Twitter::GetUserDetails($info['headers']['x-twittersenderscreenname']);
if ($user and User::SetStatus($info['headers']['x-twittersenderscreenname'], 'active', $user->status->id)) {
$dm = 'Sorted! I\'ll start sending you emails again shortly.';
} else {
$dm = 'Grrr, something went wrong restarting your emails. I\'ve notified the team and they\'ll look into it ASAP.';
echo ' Failed to start emails for "' . $info['headers']['x-twittersenderscreenname'] . '"' . "\n\n";
}
Twitter::Tweet('d ' . $info['headers']['x-twittersenderscreenname'] . ' ' . $dm);
break;
case 'stop':
//echo 'Stop for "'.$info['headers']['x-twittersenderscreenname'].'"'."\n";
if (User::SetStatus($info['headers']['x-twittersenderscreenname'], 'inactive')) {
$dm = 'Ok, I\'ll stop sending you emails for now. Send the word "start" to restart them again.';
} else {
$dm = 'Grrr, something went wrong stopping your emails. I\'ve notified the team and they\'ll look into it ASAP.';
echo ' Failed to stop emails for "' . $info['headers']['x-twittersenderscreenname'] . '"' . "\n\n";