Twitter $get help

caurnackusa

New Member
Just wondering if someone can assist me with the following issue. I have come across the following code which pulls in latest Twitter posts and displays them on a site:\[code\]//Handle the scrolling of the tweets in the footer$(function () { var tweetVP = $("#footerTweetsViewport"); arrTweetNav = ECC.tweetArray(); thisTweetID = arrTweetNav[0]; $("ul#tweetControls > li").bind("click", function(e) { e.preventDefault(); var thisPos = $.inArray(thisTweetID, arrTweetNav); if ($(this).hasClass("tweetPrev")) { nextPos = thisPos - 1; } else { nextPos = thisPos + 1; } nextID = arrTweetNav[nextPos]; //If that tweet exists in the DOM... if ($("#listOfTweets > #" + nextID).length) { //Reset the inactive buttons $("ul#tweetControls > li").removeClass("inactive"); //Scroll to the destination tweetVP.scrollTo("#" + nextID, 200); //Set the thisID to the value of the nextID thisTweetID = nextID; } //Disable the controls if we're on the first or last tweet if (nextPos == arrTweetNav.length-1) { $("ul#tweetControls > li.tweetNext").addClass("inactive"); } else if (nextPos == 0) { $("ul#tweetControls > li.tweetPrev").addClass("inactive"); } }).bind("mousedown", function() { $(this).closest("li").addClass("click"); }).bind("mouseup", function() { $(this).closest("li").removeClass("click") });});//Search the dom for twitter containers that need tweets loaded for$(function() { $(".globalTweetWrapper").each(function() { var thisUsername = $(this).attr("class").replace("globalTweetWrapper ", ""); var tweetContainer = $(this); var loadTweets = tweetContainer.find(".loadTweets"); //Detect if we're going to flush the tweets var flushTweets = $.getUrlVar("flushTweets"); if (flushTweets != 1) { flushTweets = 0; } $.getJSON("get-tweets.cfm?username=" + thisUsername + "&flushTweets=" + flushTweets, function(data) { if (data.length && loadTweets.length) { loadTweets.remove(); $.each(data, function(i,item) { if (tweetContainer.attr("id") == "listOfTweets") { tweetContainer.append("<li class='tweetContainer' id='" + item.ID + "'>" + item.TWEET + "<small class='darkGray'>" + item.DATE + "</small></li>"); } else { tweetContainer.append("<p class='tweetContainer'>" + item.TWEET + "</p><small class='darkGray'>" + item.DATE + "</small>"); if (i == 1) return false; } }); //Rebuild the tweet array arrTweetNav = ECC.tweetArray(); thisTweetID = arrTweetNav[0]; } }); });});\[/code\]This is the HTMLcontainer for the Tweets on the site is as follows:\[code\]<div class="footerItem posRelative"><h3><a href="http://stackoverflow.com/questions/3582292/twitter url goes here/mytwitterid" rel="external" title="Follow us on Twitter">Follow us</a> on Twitter</h3><ul id="tweetControls"><li class="tweetPrev inactive">Previous Tweet</li><li class="tweetNext">Next Tweet</li></ul><div id="footerTweetsViewport"><ul id="listOfTweets" class="globalTweetWrapper"></ul>\[/code\]My site is not coldfusion; therefore I simply want to modify the get-tweets.cfm and would like some assistance please. I have come across the following:\[code\]//initialize a new curl resource$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'twitter url goes here/statuses/user_timeline/twitterusername.json?count=10');curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$content = curl_exec($ch);curl_close($ch);if($content === FALSE) {//Content couldn't be retrieved... Do something} else {//Content was retrieved do something with it.}\[/code\]So I would really like to rebuild the get-tweets.cfm to a PHP script get-tweets.php; however, I'm not sure what exactly I need this to do to get this to work as per the coldfusion script as everything else is fine?Many thanks
 
Back
Top