Return to Snippet

Revision: 44022
at April 5, 2011 05:15 by Sauljps


Initial Code
<?php  
    $username = "TwitterUsername"; // Your twitter username.  
    $prefix = ""; // Prefix - some text you want displayed before your latest tweet.  
    $suffix = ""; // Suffix - some text you want display after your latest tweet.  
    $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";  
      
    function parse_feed($feed) {  
    $stepOne = explode("<content type=\"html\">", $feed);  
    $stepTwo = explode("</content>", $stepOne[1]);  
    $tweet = $stepTwo[0];  
    $tweet = str_replace("&lt;", "<", $tweet);  
    $tweet = str_replace("&gt;", ">", $tweet);  
    return $tweet;  
    }  
      
    $twitterFeed = file_get_contents($feed);  
    echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);  
    ?>

Initial URL

                                

Initial Description

                                

Initial Title
Display lastest Tweet from user

Initial Tags

                                

Initial Language
PHP