本文整理匯總了PHP中Twitter::updateStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::updateStatus方法的具體用法?PHP Twitter::updateStatus怎麽用?PHP Twitter::updateStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::updateStatus方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$t = new Twitter(sfConfig::get('twitter_username'), sfConfig::get('twitter_password'));
$needs = NeedPeer::retrieveAllNeeds($connection);
foreach ($needs as $need) {
$message = 'People, @' . $need->getAuthor() . ' needs ' . $need->getDescription() . ' ' . $need->getTimeframe() . ', please help!';
$t->updateStatus($message);
}
}
示例2: broadcast
function broadcast($first, $last, $city = "", $gender = "", $age = "", $info = "", $photo = "", $lang = "en", $status = "missing")
{
global $twitter_debug;
if (strtolower($lang) == "ht") {
$twitter = new Twitter("haitimissingkr", "zWqOEOrC0RkPTwVOnJ88");
} else {
$twitter = new Twitter("haitimissing", "zWqOEOrC0RkPTwVOnJ88");
}
// English Twitter Feed
$update = "";
$update .= ucwords(strtolower($last));
$update .= " ";
$update .= ucwords(strtolower($first));
if (strtoupper($gender) == "M" || strtoupper($gender) == "F") {
$update .= ", " . strtoupper($gender);
}
if ($age != "") {
$update .= ", " . $age;
}
if ($city != "") {
$update .= ", " . ucwords(strtolower($city));
}
if (strtolower($status) != "missing") {
$update .= ", " . ucwords($status);
}
if ($info != "") {
$info = compress_URL($info);
if (strtolower($lang) == "ht") {
$update .= ", info: " . $info;
} else {
$update .= ", info: " . $info;
}
}
if ($photo != "") {
$photo = compress_URL($photo);
if (strtolower($lang) == "ht") {
$update .= ", photo: " . $photo;
} else {
$update .= ", photo: " . $photo;
}
}
$update .= " #haitimissing";
if ($twitter_debug) {
echo "Posted: " . $update . " in " . $lang;
} else {
$twitter->updateStatus($update);
}
}
示例3: recaptcha_get_html
echo recaptcha_get_html($publickey);
?>
<font color="red"><span id="preview"></span></font>
<p><input type="button" value="preview" onclick="previewTweet();"/>
<input type="submit" name="tweet" value="tweet" /></p>
<?php
if ($_POST["tweet"]) {
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
require_once 'twitter.lib.php';
$uid = "tweet4blood";
$pw = "Your password";
$twitter = new Twitter($uid, $pw);
$statusMsg = "REQ " . $_POST["group"] . " AT #" . $_POST["city"] . " .CONTACT " . $_POST["contact"] . " " . $_POST["info"];
echo $statusMsg . "<br>";
$twitter->updateStatus($statusMsg);
echo "<span><b><font color=green>Your message is tweeted to <a href='http://twitter.com/tweet4blood'>@tweet4blood</a> community.</font></b></span>";
} else {
echo "<span><b><font color=red>Captch is not valid. We could not tweet the message. Try again.</font></b></span>";
}
}
?>
</form>
<!-- end of middle form-->
</td>
<td width="30%"> </td>
</tr>
</table>
</td></tr>
<tr class="foot"><td></td></tr>
<table>
示例4: elseif
if (strlen($stat) > 140) {
$err = 'That was longer than 140 characters!';
} elseif ($stat == 'Say something in 140 characters.' || $stat == '') {
$err = 'Umm... You didn\'t exactly say anything...';
} elseif (!validTimestamp($_POST['submit'])) {
$err = 'Whoa! Something weird just happened. Try again, I guess? (Debug ' . intval($_POST['submit']) . ')';
} elseif (bannedTweet($stat)) {
$err = 'Sorry, I just can\'t post that.';
}
if ($err == '') {
require_once 'includes/twitter.inc.php';
$tw = new Twitter('ub3rk1ttencom', 'oopsiesthisgotleaksied');
$rets = false;
$exc = false;
try {
$ret = $tw->updateStatus(stripslashes($stat));
$rets = $ret['id'];
} catch (TwitterException $ex) {
$err = 'Uh oh! Twitter appears to be having problems right now. Anything you say won\'t go on Twitter, sadly.';
$exc = true;
}
if ($exc) {
// Fail safe if Twitter down
insertTweet($stat, $rets);
} else {
if ($rets != '') {
// If Twitter rejects, we reject
insertTweet($stat, $rets);
}
}
}
示例5: Twitter
<?php
// require the twitter library
require "twitter/twitter.lib.php";
// your twitter username and password
$username = "braincrave";
$password = $_REQUEST["password"];
// initialize the twitter class
$twitter = new Twitter($username, $password);
$tweet = $_REQUEST['tweet'];
$ret = $twitter->updateStatus($tweet);
header('Location: http://www.braincrave.org?tweetsuccess=true');
示例6: floor
}
}
}
// tweet if new posting in applicable market
$age = floor(time() - strtotime($rs_article[0]['post_time'])) / (60 * 60 * 24);
if ($rs_article[0]['status'] == 'A' && $age < 2 && !$rs_article[0]['tweet_sent'] && $rs_article[0]['market_id']) {
$aql = "market {\n\t\t\t\t\t\t\tslug as market_slug,\n\t\t\t\t\t\t\ttwitter_username,\n\t\t\t\t\t\t\ttwitter_password\n\t\t\t\t\t\t\twhere id = {$rs_article[0]['market_id']}\n\t\t\t\t\t\t}";
$rs = aql::select($aql);
$market = $rs[0];
$arr = array('tweet_sent' => 'now()');
aql::update('blog_article', $arr, $rs_article[0]['blog_article_id']);
if ($market['twitter_username']) {
//tweet
include 'lib/class/class.twitter.php';
$t = new Twitter($market['twitter_username'], $market['twitter_password']);
$aql = "blog {\n\t\t\t\t\t\t\t\tname as blog_name,\n\t\t\t\t\t\t\t\tslug as blog_slug\n\t\t\t\t\t\t\t\twhere id = {$rs_article[0]['blog_id']}\n\t\t\t\t\t\t\t}";
$rs = aql::select($aql);
$blog = $rs[0];
$url = 'http://' . $market['market_slug'] . '.joonbug.com/' . $blog['blog_slug'] . '/' . $rs_article[0]['blog_article_ide'];
$tiny_domain = 'joonb.ug';
$tinyurl = uize($url, $tiny_domain);
$status_msg = "[{$blog['blog_name']}] {$rs_article[0]['title']}, {$rs_article[0]['introduction']}";
$status_msg = substr($status_msg, 0, 100);
$status_msg .= " {$tinyurl}";
$t->updateStatus($status_msg);
echo 'Posted to twitter.com/' . $market['twitter_username'] . '<br />';
}
//if
}
echo '<span style="color: #ff0000;">Saved.</span>
<input type="hidden" id="blog_article_ide" value="' . $article_inserted_ide . '" />';
示例7: updateStatus
public function updateStatus($Model, $status)
{
return $this->_Twitter->updateStatus($status);
}
示例8: Twitter
<?php
// Include config file
require_once "config.php";
// Include Twitter Library (http://classes.verkoyen.eu/twitter/)
require_once "twitter.php";
// Setup twitter
$twitter = new Twitter($config['twitter']['username'], $config['twitter']['password']);
// Decode payload
if (get_magic_quotes_gpc()) {
$_POST['payload'] = stripslashes($_POST['payload']);
}
$payload = json_decode($_POST['payload']);
$numCommits = count($payload->commits);
$commitsPlural = $numCommits != 1 ? "s" : "";
$branch = str_replace("refs/heads/", "", $payload->ref);
// User is just the first commit author. Not necessarily correct, but it's the
// really the only way to know
$user = $payload->commits[0]->author->name;
$message = "{$user} pushed {$numCommits} commit{$commitsPlural} to {$branch}";
$twitter->updateStatus($message);