Hello,

My friend and I are working on an app that extracts tweets in and
around a location and displays the tweets as text as well as on the
map. We are getting tweets with geo location but are wondering how to
extract the data in the <google:location> tag. We are using PHP to
display the tweets. Along with the tweets I'd like to display the
location too (and then later on mark it on the map.

Here is an entry of the tweet in ATOM format:

 <entry>
    <id>tag:search.twitter.com,2005:66218119324123136</id>
    <published>2011-05-05T19:10:04Z</published>
    <link type="text/html" href="http://twitter.com/kath/statuses/
66218119324123136" rel="alternate"/>
    <title>Dazzling video: Plan of the City by Joshua Frankel, with
music by @juddgreenstein and @NOWEnsemble. http://bit.ly/kHXzAZ</title>
    <content type="html">Dazzling video: Plan of the City by Joshua
Frankel, with music by &lt;a href=&quot;http://twitter.com/
juddgreenstein&quot;&gt;@juddgreenstein&lt;/a&gt; and &lt;a
href=&quot;http://twitter.com/NOWEnsemble&quot;&gt;@NOWEnsemble&lt;/
a&gt;. &lt;a href=&quot;http://bit.ly/kHXzAZ&quot;&gt;http://bit.ly/
kHXzAZ&lt;/a&gt;</content>
    <updated>2011-05-05T19:10:04Z</updated>
    <link type="image/png" href="http://a1.twimg.com/profile_images/
185321700/Kath_normal.jpg" rel="image"/>
    <google:location>New York</google:location>
    <twitter:geo>
    </twitter:geo>
    <twitter:metadata>
      <twitter:result_type>recent</twitter:result_type>
    </twitter:metadata>
    <twitter:source>&lt;a href=&quot;http://twitter.com/
&quot;&gt;web&lt;/a&gt;</twitter:source>
    <twitter:lang>en</twitter:lang>
    <author>
      <name>kath (Kath)</name>
      <uri>http://twitter.com/kath</uri>
    </author>
  </entry>

Here is the code that we use to display the details of a Tweet.

foreach( $results->entry as $result )   // for ATOM
{

echo "<h3><a href=\"". $result->author->uri ."\">". $result->author-
>name ."<a/></h3><img src=\"". $result->link[1]->attributes()-
>href ."\" style=\"float: left;\"><p>". $result->content."</p><div
style=\"clear:both;\">&nbsp;</div>";
}

I was thinking more on the lines of $result->google:location.... Tried
all combinations. Nothing worked. Could not find anything on when
searching the Internet about this.

Would be great if anyone could answer this for us.

Thanks,
Pavithra

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to