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

fetch latest Twitter trends using PHP Best WordPress Hosting

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.

advertisement

Leave a Reply

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