I'm trying to get Twitter's trending topics for an area using PHP but I'm a PHP noob. This is the code using
$woeid = 2424766;
$url= 'https://api.twitter.com/1.1/trends/place.json?id='.$woeid;
$trends = $twitter->get($url);
foreach ($trends->trends as $key => $trend) {
<?=$trend->name; ?><br>
}
but when I run the code I get an error on the page stating "Warning: Invalid argument supplied for foreach() in ..line blahblah.."
Note that I based my code off of a search function that I successfully implemented. I'm not sure why this approach isn't working though.
How can I fix this and display a list of trending topics?