<?php

require_once '../src/coreylib.php';
clAPI::configure('debug', true);
$feedburner_uri = 'coreylib-cookbook';
$api = new clAPI('https://feedburner.google.com/api/awareness/1.0/GetFeedData');
$api->param('uri', $feedburner_uri);
if ($api->parse('10 minutes')) {
    ?>
	<h4><?php 
    echo $api->get('feed@uri');
    ?>
</h4>
	<p>
		<?php 
    echo $api->get('feed/entry[0]@hits');
    ?>
 hits 
		as of <?php 
    echo date('F j', strtotime($api->get('feed/entry[0]@date')));
    ?>
</p>
	</p>
<?php 
}
Exemplo n.º 2
0
            ?>
"><?php 
            echo $entry->get('title');
            ?>
</a></div>
		<?php 
        }
        ?>
	<?php 
    }
}
?>

<?php 
$api = new clAPI('http://gdata.youtube.com/feeds/api/standardfeeds/most_recent');
$api->param('v', 2);
if ($api->parse('1 hour')) {
    ?>
	<h4><?php 
    echo $api->get('title');
    ?>
</h4>
	<?php 
    $api->info();
    ?>
	<?php 
    foreach ($api->get('entry', 10) as $entry) {
        ?>
		<?php 
        // this nasty bit extracts the video id from entry@id:
        preg_match('/video:([^\\:]+)/i', $entry->get('id'), $matches);
Exemplo n.º 3
0
<?php

require_once '../src/coreylib.php';
$twitter_username = '';
$twitter_password = '';
$api = new clAPI('twitter.com/statuses/user_timeline.xml');
$api->param('count', 5);
$api->basicAuth($twitter_username, $twitter_password);
echo date('r', time());
?>

    <div id="twitter">
      <div id="twitter_div">
      <h2 class="twitter">Latest Updates <span>  &#187; Twitter</span></h2>
      <ul id="twitter_update_list">


<?php 
if ($api->parse('1 hour')) {
    ?>
      <ul>
<?php 
    foreach ($api->get('status') as $post) {
        ?>

<?php 
        $tweet = $post->get('text');
        // Convert URL's with protocol prefix
        $tweet = ereg_replace("[a-zA-Z]+://([-]*[.]?[a-zA-Z0-9_/-?&%])*", "<a href=\"\\0\">\\0</a>", $tweet);
        //Convert URL with just www.
        $tweet = ereg_replace("(^| |\n)(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://\\2\">\\2</a>", $tweet);
Exemplo n.º 4
0
<?php

require_once '../src/coreylib.php';
clAPI::configure('debug', true);
$flickrCount = eregi('iPhone', $browser) ? 12 : 10;
$api = new clAPI('http://api.flickr.com/services/rest');
$api->param('method', 'flickr.people.getPublicPhotos');
$api->param('api_key', '');
$api->param('user_id', '');
$api->param('page', 1);
$api->param('per_page', 12);
?>

<?php 
if ($api->parse('1 hour')) {
    ?>
	<?php 
    $api->info();
    ?>
	<?php 
    foreach ($api->get('photos/photo', $flickrCount) as $photo) {
        ?>
	
		<li><a href="http://www.flickr.com/photos/netgeek/<?php 
        echo $photo->get('@id');
        ?>
"><img src="http://farm<?php 
        echo $photo->get('@farm');
        ?>
.static.flickr.com/<?php 
        echo $photo->get('@server');
Exemplo n.º 5
0
<?php

require_once '../src/coreylib.php';
clAPI::configure('debug', true);
$api_key = '';
$login = '';
$api = new clAPI('http://api.bit.ly/shorten');
$api->param('longUrl', 'http://collegeman.net');
$api->param('version', '2.0.1');
$api->param('apiKey', $api_key);
$api->param('login', $login);
$api->param('format', 'xml');
?>

<?php 
if ($api->parse()) {
    ?>
	<?php 
    if ($api->get('errorCode') == '0') {
        ?>
		<?php 
        $api->info('results');
        ?>
		<?php 
        echo $api->get('results/nodeKeyVal/shortUrl');
        ?>
	<?php 
    } else {
        ?>
		<?php 
        $api->info();