Exemplo n.º 1
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.º 2
0
<?php

require_once '../src/coreylib.php';
clAPI::configure('debug', true);
clAPI::configure('trace', false);
?>

<?php 
$delicious_username = '';
$delicious_password = '';
$api = new clAPI('https://api.del.icio.us/v1/posts/recent');
$api->basicAuth($delicious_username, $delicious_password);
if ($api->parse('5 minutes')) {
    ?>
	<?php 
    $api->info();
    ?>
	<h4><a href="http://delicious.com/"<?php 
    echo $delicious_username;
    ?>
">Delicious/<?php 
    echo $delicious_username;
    ?>
</a></h4>
	<ul>
		<?php 
    foreach ($api->get('post') as $post) {
        ?>
			<li style="clear:both;">
				<a href="<?php 
        echo $post->get('@href');