125 comments found.
Hi, is it possible with this script to show replies or retweets containing a URL? For example, everytime that I generate a news article with its own link, with PHP I give it the instruction to search for tweets containing that link in order to create interaction
You can with the search request mode. Unfortunately this is not very reliable and only provides somewhat recent results.
Here you can find insight on this topic.
Quoted from the discussion:
Twitter’s search is optimized to serve relevant tweets to end-users in response to direct, non-recurring queries such as #hashtags, URLs, domains, and keywords. The Search API (which also powers Twitter’s search widget) is an interface to this search engine. Our search service is not meant to be an exhaustive archive of public tweets and not all tweets are indexed or returned. Some results are refined to better combat spam and increase relevance. Due to capacity constraints, the index currently only covers about a week’s worth of tweets.The user timeline API is the definitive source of tweets by a specific author. For a collection of recent Tweets by more than one user, consider creating a Twitter List and leveraging the list timeline. The Streaming API is often the best-fit choice when seeking completeness.
If the tweets you’re looking for aren’t available in search and you think they should be, consult this support topic for further instructions to contact @Support.
If you’re not interested in exact results, you can find an example of using the search API with this class here – http://austinbrunkhorst.com/demos/twitter-class/#examples under Live Search Ticker.
Additionally, you can find documentation on search query operators here – https://dev.twitter.com/docs/using-search.
Great to know, I just purchased it (My personal account).
—TopekaDesign
Fantastic. Thanks again for the support.
Looks like a very good product, is the author still around?
Thank you!
I sure am. Most comments here are resolved via email.
I have installed this, but all I Get is a “1”
Hi Austin, I have 2 questions.
1.) What “request_type” is used to load tweets from a (saved) cache file? UTFC core line 440 shows comment: // Handles logic for whether or not to load from the cache or make an API request. How do I load from cache?
2.) Is it possible to display the total # of tweets in the cache file?
Thanks & BTW Great script!!
Hi ChampCorp,
1. The cache system works automatically with whatever request_type that you’re using.
If the last time the cache was updated is longer than the option cache_life (by default, it’s 3600 – which is 1 hour) then it will send a new request to Twitter’s API and re-cache that data. If you want to ensure that it’s loaded from the cache, you can set a large value for the option cache_life.
2. It depends on what you mean. For cached tweets in a specific request type, you can use the method GetRequestData() and count() to determine the number of tweets.
for example.
$options = array(
// required options
// ...
);
$twitter = new Twitter($options);
// GetRequestData() returns an array, so
// we can count the number of elements.
$tweetCount = count($twitter->GetRequestData());
Excellent!! “cache_life” does the trick. I did try the count($twitter->GetRequestData()), with no joy. The response won’t echo, print_r and breaks php execution.
Any ideas?
What request type are you using?
I’m using Twitter::RequestSearch
That’s odd. Are you sure that there are actually tweets in the cache file? Also, what do you mean by breaks the PHP execution?
No worries. It’s working fine.
Hello. I keep getting the following error: Parse error: syntax error, unexpected ’:’ in /home/bccm/prarchitects.com/src/ultimate.twitter.feed.php on line 170
Hi aribble,
What version of PHP are you using?
5.3
Has this just started happening while using the script?
If you don’t mind, send me your ultimate.twitter.class.php to contact@austinbrunkhorst.com.
Sent!
Hi Austin, I am receiving a bit of a different error now: Fatal error: Class ‘TwitterException’ not found in /home/bccm/prarchitects.com/src/ultimate.twitter.feed.php on line 587 Did you receive the file I sent you?
Hi aribble,
You can’t create an instance of the class before it’s defined. Either put the code you added at the end of the file, or create a new file and include ultimate.twitter.feed.php before that code.
I will try that. Thank you!
Hmm. I am now getting this error: the following errors were reported by Twitter – Could not authenticate you; code 32.
Nevermind Austin! I regenerated my Twitter tokens and this seems to have resolved the issue. Thank you for your help! Great plugin and support!
Great! Glad you were able to resolve the issue.
Hi Austin,
I was wondering if there is a way to remove the links that twitter generates at the end of every tweet. (i.e t.co/something).
Regards,
TigerModules
Hi TigerModules,
Can you give me an example of what you mean?
Take a look at the Yellow Highlighted Links in my example http://i61.tinypic.com/euhkkh.png
Twitter does not generate those links at the end per se, but rather the account that you’re gathering the feed from manually puts them at the end.
Did you have the intention of completely removing them, expanding them to the original link, or what?
My intention is to completely remove them. But once I style the feed I could use CSS to remove them.
The easiest solution to removing links would be setting the option format_link to an empty string.
For example,
$options = array(
// other required options
// ...
'format_link' => ''
);
Hey,
I cant get the live ticker to work using the sample HTML code you provided. The ticker is just blank
Hi vfrago,
Did you properly include the other code segments? (PHP, JavaScript).
If you’re in Chrome, press CTRL + SHIFT + J to bring up the developer console. Are there any errors displayed?
Hi,
I have a problem to install the script. I sent you an email three days ago.
Thanks for support.
Hi Mqss,
I’ve responded to your email.
Hi,
Thanks for great script… when i try to setup it i fix some problems maybe it helps you
for who receives 500 internal errorsi array_merge errors, cache errors and undefined variable erros
You just comment that line
//$twitter = new Twitter($options);
For who get array merge errors
$twitter = new Twitter((array)$options);
just put (array)
Hi Chaisser,
I’m not sure what you mean – can you give me some more context?
Hey! What the PHP code to show only 1 tweet. I look at the documentation but i don’t understan how to use the Twitter::CountTotal function. Thanks
Hi lucasbc,
To show only one tweet, you must change the option “count”.
Options that are not defaulted in the class such as “format” or “screen_name” are sent to Twitter’s API. Therefore, you can find all of the options for each request mode on Twitter’s documentation for that endpoint.
You can find the list of supported request types in the options page of the script’s documentation under request_type (http://austinbrunkhorst.com/demos/twitter-class/#options). Clicking on each request type will bring you to Twitter’s documentation.
Assuming you’re using the default request type (Twitter::RequestTimelineUser) you can find the documentation here – https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline. Anything under Parameters can be used as an option in the class.
To answer your question specifically, setup your options array like this.
$options = array(
// required stuff here (consumer_key, user_token, etc.)
// display only one tweet
'count' => 1
);
Does this work on php 5.2.14?
Unfortunately this script is targeted for PHP versions 5.3 and greater.
I get the message that the Twitter codes are not correct but they are. Can you help me at this one?
Cheers
Fatal error: Uncaught exception ‘TwitterException’ with message ‘missing option required for request (consumer_key and consumer_secret and user_token and user_secret)’ in …
Hi Sam,
That error literally means that you didn’t specify the options required for making a request to the API.
You need to set the consumer_key, consumer_secret, user_token, and user_secret.
You can find a walk through for setting these options here – http://austinbrunkhorst.com/demos/twitter-class/#setup
Hi Austin,
Strange thing is, i did.
It’s working here: http://cvnbe.webhosting.be/ But not here anymore: http://cvn.be/
And the code is exactly the same on both domains? What version of PHP is running on the latter?
Yeah, kinda strange: on cvn.be: PHP Version 5.4.25 I’ve enabled my phpinfo for a second at: http://cvn.be/
Can you make a separate file that outputs just the PHP info on both servers? I’ll run a diff on the two and we can work from there.
Hi, How can i display relative time, retweet link and favorite link under my tweet text?
I think i can do this if i can get the id of the tweet. Do you know how to get the tweet id?
Got it : I used the call back function
function tweetId($tweet) { echo $tweet[‘id’]; }
Hi mbebwo,
Glad you were able to sort out the problems.
I also suggest you use the property $tweet['id_str'] as $tweet['id'] may not always return what you expect.
Hello,
in your code at line 276 “substr_replace” seems to works fine unless tweets contain special chars. Then the string will not be replaced at the correct position.
This is how a current tweet of Jenson Button looks: ?@F1_Ninana@JensonButtono@JBTrustTriri when does your triathlon take place this year?” 12th of J#JB22J#Ichibaniban
The original Tweet is: “@F1_Nina: @JensonButton @JBTrustTri when does your triathlon take place this year?” 12th of July #JB22 #Ichiban
It would be great if there is a fix for this. Thank you.
Hi w3box,
Thank you for discovering that bug. I’ve submitted an update that addresses the issue and it’s currently in queue for review on CodeCanyon.
If the update is urgent, you can send me an email at contact@austinbrunkhorst.com and I’ll send you the updated files directly.
I apologize for the inconvenience.
Thank you for the fast bugfix. Working perfect now!
Great! Glad to have helped.
A few days ago, my script stopped working. Did Twitter change something? Is anyone noticing this as well?
Hi mbebwo,
Twitter made changes to their API (requiring an SSL connection).
I’ve released an update to address this issue. Simply re-download the files from your CodeCanyon dashboard.
i have downloaded the new files and uploaded to my website. Still showing blank. Do i need to change any code anywhere?
You do not need to change any code. Did you move the file “cacert.pem” into the same directory as “ultimate.twitter.feed.php”?
Thanks. I was missing the “cacert.pem”. Works now ! Thanks for the fast responses.
No problem, glad you were able to resolve the issues.
can you please advise if you are able to allow scrolling through the previous tweets as my height is only around 150px you only see around 2 or 3 tweets but i would like to scroll through previous tweets
Are you able to reply?
Hi,
I’ve sent you a email.
Just purchased the script. Problem is that I get a blank page. Looks like your ultimate.twitter.feed.php is returning a blank. Has it to do with your recent upgrade?
This is my call:
<?php require_once ‘src/ultimate.twitter.feed.php’;
$options = array( ‘screen_name’ => ‘testappexpat’, ‘consumer_key’ => ‘zNFZ89pJ3dFg5zhD1SONRw’, ‘consumer_secret’ => ‘lxKSdDbVlipKTGO1jCsfn4aXlyAFrXXXXXX’, ‘user_token’ => ‘42975098-j1s4nPXneyPLBeKxYzKyoZVbQFATdgdjXXXXXX’, ‘user_secret’ => ‘rMx1Skf0lsJhlUAzBwAiiafEf1xP3cMIhMXXXXXXX’, );
$twitter = new Twitter($options);
$twitter->PrintFeed(); ?>
I don’t understand Please advise!
Hi Austin, you really have a great support I can see, but unfortunately your live demo are still broken after the update and I have problems with the live ticker which I can’t figure out. Can you fix some info on this issue when you got time?
Hi janjo,
Thank you for pointing that out. I’ve put the latest update on my demo server.
What issues are you having with the live ticker?
does your code work with the new SSL requirement twitter has set for accessing their API?
Yes it does. I’ve published the fixes just a few days ago.