Hi guys,
Last night I had my first play around with SimplePie (a feed aggregation script) and I decided to try out something with the Twitter Atom feed.
I am pulling entries from the ATOM feed and displaying them in a DIV on my own page. I have successfully managed to pull in Author, Link, Content and Date but I'm unable for some reason to pull in the Author Twitter. I'm not sure what I am doing wrong.
Does anyone have any ideas? Cheers.
<?php foreach ($feed->get_items() as $item): if ($author = $item->get_author()
if ($author_uri = $item->get_author_uri()) { } $feed = $item->get_feed(); ?>
<div class="item">
<h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo
$item->get_title(); ?></a></h2>
<p>Author:<?php echo $author->get_name(); ?></p>
<p>Author Twitter: <?php echo $author_uri->get_author_uri(); ?></p>
<p>Link: <?php echo $item->get_link(); ?></p>
<p>Content: <?php echo $item->get_content(); ?></p>
<p>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></p>
</div>
<?php endforeach; ?>
This is an excerpt from the Twitter Atom feed for their search page
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/UFC</id>
<link type="text/html" rel="alternate" href="http://search.twitter.com/search?q=UFC"/>
<link type="application/atom+xml" rel="self" href="http://search.twitter.com/search.atom?q=UFC"/>
<title>UFC - Twitter Search</title>
<link type="application/opensearchdescription+xml" rel="search" href="http://search.twitter.com/opensearch.xml"/>
<link type="application/atom+xml" rel="refresh" href="http://search.twitter.com/search.atom?q=UFC&since_id=1084655459"/>
<updated>2008-12-29T21:23:55Z</updated>
<openSearch:itemsPerPage>15</openSearch:itemsPerPage>
<link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?max_id=1084655459&page=2&q=UFC"/>
<entry>
<id>tag:search.twitter.com,2005:1084655459</id>
<published>2008-12-29T21:23:55Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/Convinced/statuses/1084655459"/>
<title>@bananaclipse the jiu-jitsu is the highlight of UFC for sure...but the wrestling is blah...</title>
<content type="html"><a href="http://twitter.com/bananaclipse">@bananaclipse</a> the jiu-jitsu is the highlight of <b>UFC</b> for sure...but the wrestling is blah...</content>
<updated>2008-12-29T21:23:55Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/68864557/5555_normal.jpg"/>
<link type="application/atom+xml" rel="thread" href="http://search.twitter.com/search/thread/1084655459.atom"/>
<author>
<name>Convinced (Convinced)</name>
<uri>http://twitter.com/Convinced</uri>
</author>
</entry>
</feed>