Zenax
Active Member
- Messages
- 1,377
- Reaction score
- 4
- Points
- 38
Hi,
I assume that since the re-design of the forums, this is the best place to put it.
I am building a small script with PHP, that fetches from the Twitter API. I have managed to get the JSON output, but now am at a loss as to how to process the information I receive. I was wondering if you could look at the code I have below and help me to display it properly in HTML and CSS format??
Any help greatly appreciated!! (Please ignore the terrible indentation in my code, it didn't seem to paste right from Sublime into this post.)
I assume that since the re-design of the forums, this is the best place to put it.
I am building a small script with PHP, that fetches from the Twitter API. I have managed to get the JSON output, but now am at a loss as to how to process the information I receive. I was wondering if you could look at the code I have below and help me to display it properly in HTML and CSS format??
PHP:
<?php
session_start();
require_once("twitteroauth-master/twitteroauth/twitteroauth.php");
$account = '';
function get_Tweets($account) {
$noTweets = 10;
$api_key = '';
$api_secret = '';
$access_key = '';
$access_key_secret = '';
function new_twitter_favourite_list($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connect_to_twitter = new TwitterOAuth($cons_key,$cons_secret,$oauth_token,$oauth_token_secret);
return $connect_to_twitter;
}
$connect_to_twitter = new_twitter_favourite_list($api_key, $api_secret, $access_key, $access_key_secret);
$tweets = $connect_to_twitter->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$account."&count=".$noTweets);
return $tweets;
foreach($tweets as $tweet) {
$status = $tweet->text;
$tweetTime = $tweet->created_at;
$tweetId = $tweet->id_str;
$output = '<li>'.$status.'<a style="font-size:85%" href="http://twitter.com/'.$account.'/statuses/'.$tweetId.'">'. $tweetTime .'</a></li>';
echo $output;
}
}
Any help greatly appreciated!! (Please ignore the terrible indentation in my code, it didn't seem to paste right from Sublime into this post.)