Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save onjee/b02b903c8e7904f7e2f6 to your computer and use it in GitHub Desktop.
<h2>Твиттер </h2>
<?php
$username = "you_name"; // Ваш ник в twitter.
$limit = "5"; // Количество выводимых твитов.
$prefix = "";
$suffix = "";
$tweetprefix = "";
$tweetsuffix = "<br>";
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;
function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {
$feed = str_replace("&lt;", "<", $feed);
$feed = str_replace("&gt;", ">", $feed);
$clean = explode("<content type=\"html\">", $feed);
$amount = count($clean) - 1;
echo $prefix;
for ($i = 1; $i <= $amount; $i++) {
$cleaner = explode("</content>", $clean[$i]);
echo $tweetprefix;
echo $cleaner[0];
echo $tweetsuffix;
}
echo $suffix;
}
$twitterFeed = file_get_contents($feed);
parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment