Skip to content

Instantly share code, notes, and snippets.

@yuxel
Created July 22, 2015 18:18
Show Gist options
  • Save yuxel/62fae50148e99854daef to your computer and use it in GitHub Desktop.
Save yuxel/62fae50148e99854daef to your computer and use it in GitHub Desktop.
<?php
require_once('TwitterAPIExchange.php');
$settings = array(
'oauth_access_token' => "",
'oauth_access_token_secret' => "",
'consumer_key' => "",
'consumer_secret' => ""
);
$url = 'https://api.twitter.com/1.1/statuses/retweets/623401277419089920.json';
$getfield = '?count=100';
$twitter = new TwitterAPIExchange($settings);
$tweets = $twitter->setGetfield($getfield)
->buildOauth($url, "GET")
->performRequest();
$tweets = json_decode($tweets);
$total = count($tweets);
$users = array();
for($i = 0; $i < 4; $i++) {
$rand = rand(0, $total - 1);
$user = "@" . $tweets[$rand]->user->screen_name;
array_push($users, $user);
}
echo "Kazanan kullanici: " . $users[0];
echo "<h2>Yedek kullanicilar</h2>";
foreach (array_slice($users, 1) as $member) {
echo $member . "<br>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment