本文整理匯總了PHP中Twitter::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::save方法的具體用法?PHP Twitter::save怎麽用?PHP Twitter::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: TwitterLib
try {
// create instance
$twitterLib = new TwitterLib(CONSUMER_KEY, CONSUMER_SECRET);
// get a request token
$response = $twitterLib->oAuthRequestToken('oob');
} catch (Exception $e) {
exceptionHandler($e);
}
if (isset($response)) {
$twit = new Twitter($words[1], $words[2], $response['oauth_token']);
$twitters[$words[1]] = $twit;
// Notify the user
$url = "https://api.twitter.com/oauth/authorize?oauth_token={$response['oauth_token']}";
send($sock, "PRIVMSG {$nick} :Please visit {$url} and obtain your PIN number. Then, return to this PM and type \"!pin <bot_username> <bot_password> <yourpin>\" for example: !pin fred mysecretpass 6789567");
// Save the object
$twit->save(SAVE_DIR . "/{$twit->name}.save");
unset($response);
} else {
send($sock, "PRIVMSG {$nick} :Twitter is broken. Please try again later.");
}
}
}
break;
case 'pin':
if (count($words) < 4) {
send($sock, "PRIVMSG {$nick} :Syntax: !pin <bot_username> <bot_password> <pin>");
} else {
$twit = null;
foreach ($twitters as $twitter) {
if ($twitter->name == $words[1]) {
if ($twitter->checkPass($words[2])) {
示例2: User
require "User.php";
require "Services.php";
ActiveMongo::connect("test");
User::drop();
Twitter::drop();
Blog::drop();
/* Create an user for our 'aggregator' */
$user = new User();
$user->username = "crodas";
$user->password = "crodas";
$user->save();
/* Create one service */
$twt = new Twitter();
$twt->user = $user;
$twt->rss = "http://twitter.com/statuses/user_timeline/crodas.rss";
$twt->save();
/* Create another service */
$blg = new Blog();
$blg->user = $user;
$blg->rss = "http://crodas.org/feed/rss";
$blg->save();
/* Create another service */
$blg1 = new Blog();
$blg1->user = $user;
$blg1->rss = "http://crodas.org/feed/rss";
$blg1->save();
/* Add references to the current user to its services */
$user->add_service($blg);
$user->add_service($blg1);
$user->add_service($twt);
$user->save();