<!DOCTYPE html> <html>
<head> <link rel="stylesheet" href="index.css" type="text/css" media="screen" /> <script src="jquery-1.6.min.js" type="text/javascript"></script> <script src="../dist/jquery.syntax.js" type="text/javascript"></script> <script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { jQuery.syntax(); }); </script> </head> <body> <h1>Syntax: PHP</h1> <pre><code class="syntax php"><?php $curl = curl_init(); $options = array(CURLOPT_URL => 'http://api.twitter.com/1/statuses/public_timeline.json', CURLOPT_RETURNTRANSFER => true); curl_setopt_array($curl, $options); $json = curl_exec($curl); $obj = json_decode($json); $val5 = trim($_GET['val5']); $val10 = trim($_GET['val10']); $val20 = trim($_GET['val20']); $count = -1; if($val5){$count = 4;} if($val10){$count = 9;} if($val20){$count = 19;} if($val1){$count = -1;} if($count<0){ echo "<img class='twitter-bird' src='twitter-bird.png' width='490px' height='315px' />"; } else { if($obj){ foreach($obj as $var => $value) { if($var<=$count){ echo "<div id='user-tweets-container'>"; echo "<a class='a-img' href='http://www.twitter.com/" . $obj[$var]->user->screen_name . "' target='_blank'><img src='" . $obj[$var]->user->profile_image_url . "' width='48px' height='48px'/></a>"; echo "<p class='text'><a class='screen_name' href='http://www.twitter.com/" . $obj[$var]->user->screen_name . "' target='_blank'>" . $obj[$var]->user->screen_name . "</a>&nbsp;"; echo $obj[$var]->text . "</p><br/>"; echo "</div>"; } } }else{ echo "<p class='text'><br>Not able to retrieve Tweets... Please try again later...</p><br/>"; } } ?></code></pre> </body>
</html>