title: Get Twitter trending topics using PHP
body: <p>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 </p>
  
  <pre><code>    $woeid = 2424766;
      $url= 'https://api.twitter.com/1.1/trends/place.json?id='.$woeid;
      $trends = $twitter-&gt;get($url);
      foreach ($trends-&gt;trends as $key =&gt; $trend) {
          &lt;?=$trend-&gt;name; ?&gt;&lt;br&gt;
      }
  </code></pre>
  
  <p>but when I run the code I get an error on the page stating "Warning: Invalid argument supplied for foreach() in ..line blahblah.."<br>
  Note that I based my code off of a search function that I successfully implemented. I'm not sure why <em>this</em> approach isn't working though.</p>
  
  <p><strong>How can I fix this and display a list of trending topics?</strong>  </p>