jquery - Get latest tweets through twitter search not working? -
i'm using following code latest tweets specific hashtag
$(document).ready(function(){ getlatesttweets(); function getlatesttweets(){ var url = "http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3&callback=?"; $.getjson(url, function(json){ alert('reached'); var html = '<ul>'; $.each(json.results, function( key, result){ html += '<li><a href="#">' + '> ' + result.text + ' ...' + '</a></li>'; }); html += '</ul>'; $('#archive-twitter').append(html); }); } });
this code working fine 2 days ago stopped working today. getjson method won't succeed though when use following link
http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3
in browser actual json data
i don't know problem?
update: added test link clarify problem http://latakiancoder.com/twitter-test.php
i've tried proxified server side request , works:
js code:
$(document).ready(function(){ getlatesttweets(); function getlatesttweets(){ var url = "http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3"; $.getjson("proxy.php", { url: url }, function(json){ var html = '<ul>'; $.each(json.results, function( key, result){ html += '<li><a href="#">' + '> ' + result.text + ' ...' + '</a></li>'; }); html += '</ul>'; $('#archive-twitter').append(html); }); } });
proxy.php code:
<?php $url = $_get['url']; $json = file_get_contents($url); echo $json; ?>
Comments
Post a Comment