Skip to content
This repository has been archived by the owner on Mar 10, 2018. It is now read-only.

Added Server for get twitter timeline #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,17 @@ Tweetable also supports [timeago](https://github.com/rmm5t/jquery-timeago). for
cacheInMilliseconds {Integer} // Time to keep the most recent tweets in cache before requesting new ones
onComplete: {Object} // Function callback after event triggered

To get CONSUMER KEY, CONSUMER SECRET, and access Tokens, you must create an app in your twitter account

https://apps.twitter.com/

Requeriments: Abraham's TwitterOauth, you can download in:
https://twitteroauth.com/


### Changelog
#### 2.2
* Added API for remote twitter

#### 2.1
* Added caching for improved performance
Expand Down
32 changes: 32 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
require "twitter/autoload.php";
$CONSUMER_KEY='Your Consumer key';
$CONSUMER_SECRET='Your Consumer Secret';
$accessToken='Your access Token';
$accessTokenSecret='Your Secret access Token';
$id=$_GET['screen_name'];
$limit=$_GET['limit'];
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $accessToken, $accessTokenSecret);
$twitterData = $connection->get(
'statuses/home_timeline',
array(
'screen_name' => $id,
'count' => $limit
)
);
$tweets=array();
$i=0;
if(!empty($twitterData)){
foreach($twitterData as $tweet){
if (!empty($tweet->id))
{
$tweets[$i]['tweet_date']=date("YM d H:i:sTZY",strtotime($tweet->created_at));
$tweets[$i]['response']=$tweet->text;
$i++;
}
}
}
$result['tweets']=$tweets;
echo json_encode($result);
?>
4 changes: 2 additions & 2 deletions tweetable.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var tweetList = jQuery('<ul class="tweetList">')[opts.position.toLowerCase() + 'To'](act);
var shortMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
// var api = "http://api.getmytweets.co.uk/?screenname=";
var api = "http://plugins.theodin.co.uk/tweetable/statuses/?screen_name=";
var api = "index.php?screen_name=";
var limitcount = "&limit=";
var callback = "&callback=?";
var tweetMonth;
Expand Down Expand Up @@ -234,4 +234,4 @@
};

})(jQuery);
jQuery.support.cors = true;
jQuery.support.cors = true;
2 changes: 1 addition & 1 deletion tweetable.jquery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.