{"id":259,"date":"2010-10-03T21:38:39","date_gmt":"2010-10-03T21:38:39","guid":{"rendered":"http:\/\/soliloquyforthefallen.net\/blog\/?p=259"},"modified":"2015-03-05T07:17:56","modified_gmt":"2015-03-05T07:17:56","slug":"twitter-script-update","status":"publish","type":"post","link":"https:\/\/soliloquyforthefallen.net\/?p=259","title":{"rendered":"Twitter Script Update"},"content":{"rendered":"<p>Howdy.  Twitter changed the search format, which means my php twitter script wasn&#8217;t working correctly.  I finally took the time to remedy that tonight.  Here&#8217;s the updated source code:<\/p>\n<pre lang=\"PHP\" escaped=\"false\"><?php\n\n    \/\/ the function\n    \/**\n     * @desc Get latest tweet from a Twitter account\n     * @param string The account's username\n     * @return string The tweet\n     * http:\/\/www.phoenixheart.net\/2009\/05\/code-snippet-1-get-latest-tweet\/\n     *\n     *\/\n    function get_latest_tweet($username)\n    {\n        $url = \"http:\/\/search.twitter.com\/search.atom?from=$username&#038;rpp=1\";\n        $content = file_get_contents($url);\n        $content = explode('<content type=\"html\">', $content);\n        $content = explode('<\/content>', $content[1]);\n        return html_entity_decode($content[0]);\n    }\n    $my_tweet = get_latest_tweet('Username');\n    if ($my_tweet != NULL)\n        {\n\n            echo \"$my_tweet\";\n        }\n    else {\n        echo \"Twitter is having issues again . . . .\";\n        }\n\n    ?><\/pre>\n<p>You can reference <a href=\"http:\/\/soliloquyforthefallen.net\/blog\/2010\/06\/23\/twitter-feed-on-homepage-code\/\">my old blog post<\/a> if you want to know more how it works.  For the copy\/paste types: make sure you cange &#8220;Username&#8221; on line 20 to your twitter ID.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Howdy. Twitter changed the search format, which means my php twitter script wasn&#8217;t working correctly. I finally took the time to remedy that tonight. Here&#8217;s the updated source code:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[117],"tags":[],"_links":{"self":[{"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/posts\/259"}],"collection":[{"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=259"}],"version-history":[{"count":1,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":765,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=\/wp\/v2\/posts\/259\/revisions\/765"}],"wp:attachment":[{"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soliloquyforthefallen.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}