php - How do I get only the new tweets per request using Twitter API? -
i'm trying new tweets containing hashtag twitter api. thing i'm interested in number of new tweets each time request results. this:
10:20 am: 100 tweets containing #google 10:22 am: 130 tweets containing #google
but right somehow results stay same. 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 updates?
edit: code works, results not updates. same results on , on again.
$(document).ready(function() { setinterval(function(){ gettweets();}, 5000); });
Comments
Post a Comment