How to fetch latest Twitter trends using PHP: Twitter API Part 2


This is the third article of Twitter API series. I already published article on Twitter Login with PHP and Tweet using PHP and Twitter API. In this article, I will tell you how to get latest trends of any location using Twitter API and PHP.

If you have not read the previous two articles of Twitter API, you must. It is because I will not repeat the process of obtaining the token and secret. These things are essential for using the API.

Twitter shows location based trends. So, you need to specify a location for getting the trends of that location. But it uses WOEID as location input. So, you need to know the WOEID of that location. You can use this link to search the WOEID of any city.

When you have WOEID, you can use the code given below to fetch the latest trends. This code will work only if you use same twitteroauth.php and config.php file.

I have already explained how to obtain secret and token in the first tutorial. If you have not read that, you will find this code hard to understand.



Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Leave a Reply

Your email address will not be published. Required fields are marked *


Post Tweets Using PHP

How to Post Tweets Using PHP : Twitter API Part 2

5 Best Free CDN Services to Speed up WordPress Website