changed git call from https to git readonly
[atutor.git] / mods / twitter / Twitter.php
1 <?php
2
3 class Twitter
4 {
5
6         function search($term){
7                 $curl_handle=curl_init();
8                 curl_setopt($curl_handle,CURLOPT_URL,'http://search.twitter.com/search.json?q='.$term);
9                 curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
10                 curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
11                 $buffer = curl_exec($curl_handle);
12                 curl_close($curl_handle);
13
14                 if (empty($buffer)){
15                     print "Sorry, Connection not available right now.";
16                 }
17                 else{
18                     return json_decode($buffer,true);
19                 }
20         }
21 }
22
23
24
25 ?>