1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Twitter Send Tweet</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"> </head> <body> <?php /** * Twitter API * @author Selim Hallaç * selimhallac@gmail.com */ /** * Twitter API File * Twitter API Dosyası */ include "twitteroauth/twitteroauth.php"; /** * Twitter API Config * Twitter API için gerekli bağlantı bilgileri */ $consumer_key = ''; $consumer_secret = ''; $accesstoken = ''; $accesstokensecret = ''; /** * Twitter API Connections * Twitter API ile bağlantı * @var TwitterOAuth */ $twitter = new TwitterOAuth($consumer_key, $consumer_secret, $accesstoken, $accesstokensecret); $placecode = '23424969'; // Bölge kodu, yahodan bulabilirsin ben şuan Türkiye için koydum $trendlist = $twitter->get('https://api.twitter.com/1.1/trends/place.json?id='.$placecode); echo "<pre>"; print_r($trendlist); echo "</pre>"; foreach ($trendlist['0']->trends as $key => $value) { $tweet['status'] = $value->name." ".rand(0,150); # Tweet Attırma. $twitter->post('statuses/update',$tweet); } ?> <pre> </pre> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> </body> </html> |
Okumaya devam...