Return to Snippet

Revision: 22165
at January 4, 2010 15:38 by bitmanic


Initial Code
<?php
	// Get the Twitter search results
	$xml = simplexml_load_file("http://search.twitter.com/search.atom?q=vespa%20scooter");
	
	// Prints the returned array to the page so you can see what's up
	// print_r($xml);
?>

<ol id="search-results">

<?php
foreach($xml->entry as $e){
	$status_link = $e->link[0]['href'];
	$user_name = $e->author->name;
	$user_link = $e->author->uri;
	$thumb = $e->link[1]['href'];
?>

	<li class="hentry status search_result">
		<span class="thumb vcard author">
			<a class="tweet-url profile-pic" href="<?=$user_link?>"><img alt="" src="<?=$thumb?>" width="48" height="48" /></a>
		</span>
		<span class="status-body">
			<a class="tweet-url screen-name" href="<?=$user_link?>"><?=$user_name?></a>
			<span id="msgtxt6185685937" class="msgtxt en"><?=$e->content?></span>
		</span>
	</li>

<?php } ?>

</ol>

Initial URL


Initial Description


Initial Title
SimpleXML code for a Twitter search

Initial Tags
search, twitter

Initial Language
PHP