本文整理匯總了PHP中Twitter::getMentions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::getMentions方法的具體用法?PHP Twitter::getMentions怎麽用?PHP Twitter::getMentions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::getMentions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateTwitterCache
function updateTwitterCache($cache_file)
{
if (!file_exists($cache_file)) {
$file = fopen($cache_file, "w");
//changed r to w
fclose($file);
}
if (time() - filemtime($cache_file) >= 90) {
require "twitter.lib.php";
require "config.php";
$twitter = new Twitter($twitteruser, $twitterpass);
$xml = $twitter->getMentions();
$twitter_status = new SimpleXMLElement($xml);
$fp = fopen($cache_file, 'w');
//changed twitter.csv to $cache_file
foreach ($twitter_status->status as $status) {
foreach ($status->user as $user) {
fputcsv($fp, array($status->created_at, $status->id, $status->text, $status->source, $user->name, $user->screen_name, $user->description, $user->profile_image_url, 'http://www.twitter.com/' . $user->name, $user->followers_count));
}
}
fclose($fp);
}
}
示例2: Twitter
<?php
require_once 'config.php';
require_once 'functions.php';
require_once 'Twitter.php';
$twitter = new Twitter();
$twitter->setCredentials($config['username'], $config['password']);
$next_tweet = file_get_contents(dirname(__FILE__) . '/nextCoffeeTweet.txt');
$since_id = file_get_contents(dirname(__FILE__) . '/lastMention.txt');
$mentions = $twitter->getMentions($since_id);
if (!is_array($mentions)) {
die;
}
foreach ($mentions as $mention) {
if ((string) $mention->id > $since_id) {
$since_id = (string) $mention->id;
}
if (strpos(strtolower($mention->text), 'wann') !== false || strpos(strtolower($mention->text), 'when') !== false) {
$time = $next_tweet - time();
if ($time <= 0) {
$next_tweet = calculateNextCoffeeTweet();
$time = $next_tweet - time();
}
if (date('w', $next_tweet) == 0 || date('w', $next_tweet) == 6) {
$message = 'erst wieder am Montag';
} else {
if (date('d', $next_tweet) != date('d')) {
if (date('w', $next_tweet) == 1 && date('w') == 5) {
$message = 'am Montag';
} else {
if ($next_tweet - time() < 24 * 3600) {