This is comment page 3 for Authenticating a Twitter Feed for OAuth API V1.1 - Timelines & streams »
Creating a Custom jQuery Twitter Feed (API v1.1) »
Creating a Twitter Search & Analytics tool »
hi tom, its not working for me
its my link
This is the second tutorial i’ve looked at and this one seemed to be way more helpfull than the first (At least i’m getting some sort of error) I changed my get_tweet.php file to have my codes and have everything in the right directory, but i’m still getting a white screen with “null” in the top left corner. My server should be running PHP 5.2 and my php file does not have a callback argument in it. I’m not sure what else might be wrong.
Hi – thank you for the tutorial – works excellently!
My question is that – how can I add two domains to make it work?
For instance www. – works and without www does not work.
Thank you – apologies if someone has already answered this, I couldn’t find the answer!
Hi i have used this library but some how i got error on OAuth.php on line no 386. there is port @$parts[‘port’] is there . it is showing me null when i comment it and its repective code line then no error will occur but i got null as a out put. it is not workig for me. can any one tell me what to do now. Please help me.
Hi Tom,
I am stuck in this API integration. i am integrating it with opencart. can you tell me what to do. i need help. i am in trouble.
I’m getting {“errors”:[{“message”:”Internal error”,”code”:131}]}.
I had to reset my keys for some reason.. WORKS!
Just Brilliant!! Wonderful!!! Thank you
hey, is there a similar tutorial for Java
Thanks for the tutorial – quick question, is it possible to use javascript for this new API as I need to embed the twitter timeline on a html page.
Hi
Thanks for the tutorial but I can’t get this too work, it seems to be showing info but I must have missed something. This is the link with my problem, any ideas?
Thanks in Advance
Dan
Hi Tom,
thanks for this awesome tutorial.
but I’m getting response :
errors: [{message:Could not authenticate you, code:32}]
Here’s my code :
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
public function twit() {
$twitteruser = “cuheguevara”;
$notweets = 30;
$consumerkey = “myconsumerkey”;
$consumersecret = “myconsumersecret”;
$accesstoken = “mytoken”;
$accesstokensecret = “EY9JhbtBCjXux40ieJh5TsnRqjscBnQ0Jii5urk9c”;
$connection = $this->getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get(“https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=” . $twitteruser . “&count=” . $notweets);
echo json_encode($tweets);
}
Any Help ?
Hi Tom.
Great tutorial. now my code is worked.
I create new application π
Hi Tom
Thank you for the fantastic tutorial this has been a great help. I have got everything working fine using the tutorial code to display a static feed. I haven’t used the caching feature as the site has very low traffic levels.
In an earlier post you made reference to a javascript file that used animation.
https://tomelliott.com/demos/jquery-twitter-feed/js/twitterfeed-main.js
I have looked through the script and this code from line 21 or so seems to point to a cached txt file of feeds.
$.ajax({
url: ‘/demos/jquery-twitter-feed/’+twitterprofile+’-tweets.txt?’+Math.random(),
dataType: ‘json’,
success: function(feeds) {
I have tried to edit this script using the code from the static js provided in the example to take the json from the php file as follows
$.getJSON(‘http://www.advmultimedia.co.uk/twitteraut.php’,
function(feeds) {
This however generates a syntax error on line 105
error: function(jqXHR, exception) {
Now I think the error is because I have omitted an opening “{” with the replacement tag. I have tried and failed to remove the error and cant get it to work for the life of me.
Can you advise on what code would need to be entered to enable the php authentication file to provide the json information for the feed to allow the animated version to work?
Many thanks
Dave
ok, just got it working
simply added another opening tag { in front of the line 105
{error: function(jqXHR, exception) {
Thanks for all of your efforts, you are a legend!!!!
I am getting an error – Internal Server error.
I have checked my path to twitteroauthphp and that is correct. My server is running php 5.3. my path to get-tweet1.1.php is correct. I am really stumped. In the get-tweets.php file on line 19 ( $tweets = $connection->get(“https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=”.$twitteruser.”&count=”.$notweets); ) does scree_name need to be changed to your twitter username. I am just at a loss.
Got it working. It was my js.
I have gotten this code to work, but I am having a problem putting together the proper flow for the following behavior:
I want to pull messages from a database table and automatically post tweets in behalf of users that have authorized my app to do so.
In order for that to happen, I need to login the user without a browser since I want to trigger this script with a cron job. Has anyone seen a solution for this?
I am been able to post tweets for my own account by using the access token and access token secret data. But, working out a way to get these for a user that has authorized my app read and write access has proved challenging.
Thanks in advance for any help.
Thanks a lot, your post was very very help full.
Thanks for sharing this code.
It really help me to display tweet.
I have one question how do I pull usermention. I visited this link https://dev.twitter.com/docs/api/1/get/statuses/mentions but I am not able to find.
Could you help me something.
Hi Tom,
Thank you for the script. It proves much useful in my project!
The only thing I found that the tweets that are displayed are not the most recent. The displayed tweets are older than the most recent one.
Any help would be highly appreciated π
It helped a lot, thank you!
PS: It’s not a big prob but the path to twitteroauth library is “twitteroauth/twitteroauth.php” and not “twitteroauth/twitteroauth/twitteroauth.php”. π
Hi,
I am also getting the null return from the get tweets php script. It is working perfectly on my testing instance (5.3.2), but when I migrate it to the production shell (project is hosted from sourceforge), the script returns null:
http://www.open-emr.org/twitter/tweets.php
Here is the php version info (it appears version should be good and curl is activated):
[removed]
Let me know if you need to see the php script (it is basically copy/pasted from yours and again works perfectly on my local testing instance).
Happy to debug this if needed with some guidance since main project page is a bit dysfunctional at the News section:
http://www.open-emr.org/
thanks,
-brady
Hi, I had it working on my websites for months, until today… all of them chased and doesn’t load the timeline, it’s frozen on the loading gif.
The error I get is “Uncaught TypeError: Cannot read property ‘length’ of null”
Any idea what it could be causing this problem? I already updated the jquery version to 1.10.2, and I saw your Troubleshooting tip 4 but couldn’t quite understand it.
I am repeatedly getting an Internal Server Error, and I’m not sure how to make the filepath not relative as I am being hosted on a hosting service. Any solutions to this?
Excellent tutorial! I’m currently going through a WordPress Plugin tutorial at https://tutsplus.com (how to use Twitter API), and I almost gave up on that lesson since it was using the old API method.
After seeing your blog and applying the instructions, the twitter API works like a charm!
Hey Tom!
Amazing tutorial, so up to date too, which is not something I can say for any other API tutorials I’ve found online.
Just a quick question (and sorry if it’s been answered above) but how could I use this to track a specific hashtag?
Thanks again!
Jon
After banging my head into the wall all day trying to decipher Twitter’s documentation to conjure up some magic, this got me there in less than 30 minutes. Much appreciated!
{“errors”:[{“message”:”Sorry, that page does not exist”,”code”:34}]} in get-tweets.php – what can be a reason of that ?
if you can’t connect, change this line with your proper “screen_name” in get-tweets1.1.php
$tweets = $connection->get(“statuses/user_timeline”, array(“screen_name” => “screen_name”, “count” => 10));
Hi Elliot
You helped me a little while ago make the twitter feed responsive and i was able to get that done, which is great. but I wondered if you could help me one more time…
I am trying to get the feed to work on this page http://tanisharose.com/beta/lyrics/jezebel.asp but I keep getting this error: error – Internal Server Error
At first I thought it was because I was referencing the twitter php and js files outside this folder, but I created the same structure inside the folder and still no go.
I cant figure out what is wrong because its set up the same one level up. Any help would be greatly appreciated.
Cheers
Hi Tom this is an awesome article. I just have a problem :/ I’m getting a blank white div. Maybe you can help me? I read troubleshooting tip 3 but I don’t know what relative path means (I noob) Thank you very much π
I got it to work… Mostly. No tweets are coming through the box. What have I got wrong here? Your help is greatly appreciated. π
Thank you!
Hi Tom,
I had a simple C++ app which used to get information from Twitter (in JSON format) thru the string like : “http://search.twitter.com/search.json?q=HOLLYWOOD&show_user=true&result_type=mixed&page=15&rpp=100” .
Now it has stopped working as twitter has migrated to v1.1. I can understand the fact that I have to include the Authentication stuff here in my string request. I am yet to create my Auth details in Twitter, but I am unable to find anywhere in the internet as to how I should pass those Auth details in my string request. I don’t have any knowledge in Java or PHP. I was not able to find it in this site also, or maybe I am doing something wrong. So would you kindly help me and guide me here???
Thanks in advance,
Thanks very much, there were some definite issues there, a bit better bit still no cigar… The path to twitteroauth.php seems correct, but still I dont get anything… What could it be?
the path is [removed]
which is the correct path for just about everything else… I noticed that the php file came up blank, too.
Total noob here sorry. I don’t think I am “running” php 5.2.x or higher, I wasn’t aware – so more than likely I am not. Hopefully that is the problem. Thank you for helping me narrow this down. I’m really hoping that’s it! Maybe there’s a quick link you have to inform me? I think I will also do a search my self.
Thanks again π
Aha… I see what you mean about the absolute path. It’s working now, except all the tweets are jammed up at the top. I’m currently seeing if it’s a styling issue or maybe something in the javascript. Thanks again Tom, you’ve been a great help so far.
Thanks for this Tom – but its not exactly beginner friendly with all the chat about php files and uploading to servers etc… is there anyway to get around all this hoopla?
Step 2 is just a bit much for the humble wordpress newbie. Any suggestions? Seems a bit much for a twitter feed…
Thanks,
Ollie.
vi your php.ini
search for curl & remove curl_exec
Restart apache.
This will allow curl in php
how can I get this to work with a wordpress theme that is giving me this error message, the documentation is pointing to this site for reference in setting tweets up.
Just got this working in 20 mins on a new site we are developing, looks and works great http://www.burgerland.co.uk
Tom,
thanks so much for this walk through. I am very new to PHP and seem to be running up against something odd. When the script runs, all I get is a page with the actual PHP from Abraham. My understanding is that this means PHP isn’t enabled on my server but it very much IS enabled (5.4).
1&1 is my hosting provider, wondering if it could be an issue with them…
thanks a lot π