I'm trying to get new tweets containing some hashtag from Twitter API. The thing I'm interested in is the number of new tweets each time I request the results. So like this:
10:20 AM: 100 tweets containing #google
10:22 AM: 130 tweets containing #google
But right now somehow my results stay the same. This is my code:
PHP (tweets.php):
<?php
$json = file_get_contents('http://search.twitter.com/search.json?q=%23apple:)&include_entities=true&rpp=100', true);
echo $json;
?>
Javascript:
function getTweets() {
var tweets = 0;
$.ajax({
url: "tweets.php",
crossDomain: true,
dataType: 'JSON'
}).done(function(data) {
$.each( data.results, function( key, value ) {
console.log(value.entities);
tweets++;
});
});
}
$(document).ready(function() {
setInterval("getTweets()", 5000);
});
How can I get only the updates?
EDIT: My code works, but the results are not really updates. They are just the same results over and over again.