Exemplo n.º 1
0
	<!-- create a new API parser with the feed address -->
	<?php 
    $api = new clAPI('http://buzz.googleapis.com/feeds/108964711519495307614/public/posted');
    ?>
	<!-- parse it  -->
	<?php 
    if ($api->parse()) {
        ?>
		<!-- uncomment this line if you want a pretty tree to explore -->
		<?php 
        //$api->info()
        ?>
		<!-- use xpath to grab all of the <entry> elements -->
		<ul>
		<?php 
        foreach ($api->xpath('//feed:entry') as $entry) {
            ?>
			<!-- for each entry element, grab the alternate link and the content -->
			<?php 
            $content = $entry->first('feed:content')->__toString();
            $content = substr($content, 5, strlen($content) - 5);
            $href = $entry->first('feed:link[@rel="alternate"]/@href');
            ?>
	
			<li><?php 
            echo $content;
            ?>
 <a href="<?php 
            echo $href;
            ?>
">&raquo;</a></li>
        if ($a->watchers == $b->watchers) {
            return 0;
        }
        return $a->watchers < $b->watchers ? -1 : 1;
    }
    ?>
                    
                    <div id="projects">
        				<?php 
    $api = new clAPI('http://github.com/api/v1/xml/kennethreitz');
    ?>
        				<?php 
    if ($api->parse('1 hour')) {
        ?>
        					<?php 
        foreach (array_reverse($api->xpath('//repository')) as $repo) {
            ?>
        						<div>
        							<h2 style="margin: 1em 0 0.3em -0.8em;">
        								&raquo; <a href="<?php 
            echo $repo->url;
            ?>
" class="black">
        								<?php 
            echo $repo->name;
            ?>
 
        								<?php 
            if ($repo->fork == 'true') {
                ?>
        									<span class="grey">&nbsp;#fork</span>