<style>
.tweet_feed{color:#333; font-family: sans-serif; margin-top:15px;}
.tweet_feed p{margin: 0;}
.tweettitle{font-size:12px;}
.tweettitle a{color:#992626; font-size:12px;}
.tweet_feed a{color:#992626; font-size:10px;}
</style>
<?php
// Pull from which accounts? Separated by a space, for example: Username Username Username
$usernames = "Username1 Username2 Username3";
// Number of tweets to pull in, total.
$limit = "4";
// Show username? 0 = No, 1 = Yes.
$show = 1;
// REMEBER: When using HTML, escape double-quotations like this: \"
// This comes before the entire block of tweets.
$prefix = "";
// This comes before each tweet on the feed.
$prefix_sub = "";
// This comes after the username but before the tweet content.
$wedge = "";
// This comes after each tweet on the feed.
$suffix_sub = "";
// This comes after the entire block of tweets.
$suffix = "";
// It is recommended that you do not modify below this point without PHP knowledge.
function parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub) {
$usernames = str_replace(" ", "+OR+from%3A", $usernames);
$feed = "http://search.twitter.com/search.atom?q=from%3A" . $usernames . "&rpp=" . $limit;
$feed = file_get_contents($feed);
$x = new SimpleXmlElement($feed);
for($i=0;$i<$limit;$i++)
{
$autor_name = $x->entry[$i]->author->name;
$autor_name = explode(" (",$autor_name);
$autor_name = $autor_name[0];
$autor_uri = $x->entry[$i]->author->uri;
$title = $x->entry[$i]->title;
$updated = date("Y-m-d",strtotime($x->entry[$i]->updated));
$now = strtotime(date("Y-m-d")); // or your date as well
$your_date = strtotime($updated);
$datediff = $now - $your_date;
$days_count = floor($datediff/(60*60*24));
if($days_count > 0)
{
$days_count = 'a';
}
else
{
$days_count = $days_count;
}
$tweet_url = $x->entry[$i]->link[0]['href'];
$tweet_id = $x->entry[$i]->id;
$tweet_id = explode(":",$tweet_id);
$tweet_id = end($tweet_id);
echo '<div class="tweet_feed">
<p class="tweettitle"><a href="'.$autor_uri.'" target="_blank">'.$autor_name.'</a> '.$x->entry[$i]->title.'</p>
<p class="otherinfo"><a href="'.$tweet_url.'" target="_blank">'.$days_count.' days ago</a> - <a href="https://twitter.com/intent/tweet?in_reply_to='.$tweet_id.'" target="_blank">reply</a> - <a href="https://twitter.com/intent/retweet?tweet_id='.$tweet_id.'" target="_blank">retweet</a> - <a href="https://twitter.com/intent/favorite?tweet_id='.$tweet_id.'" target="_blank">favourite</a></p>
</div>';
}
}
echo '<div style="background: url(twitterbox.png) no-repeat scroll 0 0 transparent;height: 352px;margin-top: 0;padding-left: 5px;padding-right: 5px;padding-top: 65px;width: 210px;">';
parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub);
echo '</div>';
?>
.tweet_feed{color:#333; font-family: sans-serif; margin-top:15px;}
.tweet_feed p{margin: 0;}
.tweettitle{font-size:12px;}
.tweettitle a{color:#992626; font-size:12px;}
.tweet_feed a{color:#992626; font-size:10px;}
</style>
<?php
// Pull from which accounts? Separated by a space, for example: Username Username Username
$usernames = "Username1 Username2 Username3";
// Number of tweets to pull in, total.
$limit = "4";
// Show username? 0 = No, 1 = Yes.
$show = 1;
// REMEBER: When using HTML, escape double-quotations like this: \"
// This comes before the entire block of tweets.
$prefix = "";
// This comes before each tweet on the feed.
$prefix_sub = "";
// This comes after the username but before the tweet content.
$wedge = "";
// This comes after each tweet on the feed.
$suffix_sub = "";
// This comes after the entire block of tweets.
$suffix = "";
// It is recommended that you do not modify below this point without PHP knowledge.
function parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub) {
$usernames = str_replace(" ", "+OR+from%3A", $usernames);
$feed = "http://search.twitter.com/search.atom?q=from%3A" . $usernames . "&rpp=" . $limit;
$feed = file_get_contents($feed);
$x = new SimpleXmlElement($feed);
for($i=0;$i<$limit;$i++)
{
$autor_name = $x->entry[$i]->author->name;
$autor_name = explode(" (",$autor_name);
$autor_name = $autor_name[0];
$autor_uri = $x->entry[$i]->author->uri;
$title = $x->entry[$i]->title;
$updated = date("Y-m-d",strtotime($x->entry[$i]->updated));
$now = strtotime(date("Y-m-d")); // or your date as well
$your_date = strtotime($updated);
$datediff = $now - $your_date;
$days_count = floor($datediff/(60*60*24));
if($days_count > 0)
{
$days_count = 'a';
}
else
{
$days_count = $days_count;
}
$tweet_url = $x->entry[$i]->link[0]['href'];
$tweet_id = $x->entry[$i]->id;
$tweet_id = explode(":",$tweet_id);
$tweet_id = end($tweet_id);
echo '<div class="tweet_feed">
<p class="tweettitle"><a href="'.$autor_uri.'" target="_blank">'.$autor_name.'</a> '.$x->entry[$i]->title.'</p>
<p class="otherinfo"><a href="'.$tweet_url.'" target="_blank">'.$days_count.' days ago</a> - <a href="https://twitter.com/intent/tweet?in_reply_to='.$tweet_id.'" target="_blank">reply</a> - <a href="https://twitter.com/intent/retweet?tweet_id='.$tweet_id.'" target="_blank">retweet</a> - <a href="https://twitter.com/intent/favorite?tweet_id='.$tweet_id.'" target="_blank">favourite</a></p>
</div>';
}
}
echo '<div style="background: url(twitterbox.png) no-repeat scroll 0 0 transparent;height: 352px;margin-top: 0;padding-left: 5px;padding-right: 5px;padding-top: 65px;width: 210px;">';
parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub);
echo '</div>';
?>