Created
July 7, 2017 01:41
-
-
Save impshum/53cb79e4ba6eb39c5306c6917001e0e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Requires J7mbo's API stuff: https://github.com/J7mbo/twitter-api-php | |
# REPORT ERRORS | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
# REPORT ERRORS | |
# Set timezone | |
date_default_timezone_set("Europe/London"); | |
# Replace with the location you put J7mbo's API stuff | |
require_once('php/api.php'); | |
# Whack in your keys/tokens/secrets/whelks | |
$settings = array( | |
'oauth_access_token' => "******************", | |
'oauth_access_token_secret' => "******************", | |
'consumer_key' => "******************", | |
'consumer_secret' => "******************" | |
); | |
# Declare target url | |
$ta_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; | |
# Replace with a username of your choice... Go Putin 2.0! | |
$get = '?screen_name=putln2'; | |
# Play with smelly fire | |
$requestMethod = 'GET'; | |
$twitter = new TwitterAPIExchange($settings); | |
$follow_count=$twitter->setGetfield($get)->buildOauth($ta_url, $requestMethod)->performRequest(); | |
$data = json_decode($follow_count, true); | |
# Fix the mad Twatter time stamp | |
$date = $data[0]['user']['created_at']; | |
$dated = date("jS F Y", strtotime($date)); | |
# Gather all our info | |
$bgcolor = $data[0]['user']['profile_sidebar_fill_color']; | |
$banner = $data[0]['user']['profile_banner_url']; | |
$avatar = $data[0]['user']['profile_image_url']; | |
$id_str = $data[0]['user']['id_str']; | |
$username = $data[0]['user']['name']; | |
$location = $data[0]['user']['location']; | |
$description = $data[0]['user']['description']; | |
$created_at = $data[0]['user']['created_at']; | |
$favourites_count = $data[0]['user']['favourites_count']; | |
$followers_count = $data[0]['user']['followers_count']; | |
$friends_count = $data[0]['user']['friends_count']; | |
# Print some shitty html | |
echo "<div style='background-color: #$bgcolor;'>"; | |
echo "<img src='$banner'>"; | |
echo "<img src='$avatar'>"; | |
echo "<ul>"; | |
echo "<li>$username</li>"; | |
echo "<li>ID: $id_str</li>"; | |
echo "<li>Location: $location</li>"; | |
echo "<li>About: $description</li>"; | |
echo "<li>Favourites: $favourites_count</li>"; | |
echo "<li>Followers: $followers_count</li>"; | |
echo "<li>Following: $friends_count</li>"; | |
echo "<li>$dated</li>"; | |
echo "</ul>"; | |
echo "</div>"; | |
# Have a cup of tea | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment