topical media & game development

talk show tell print

mashup-delicious-11-delcache-index.php / php



  <?php
  //amazon s3 bucket rest url
  define('BUCKET_URL','http://username_delcache.s3.amazonaws.com/');
  
  //redirect to the cache if url is specified
  if (isset(_GET['url'])) {
      file_key = md5(_GET['url']);
      Header("Location: ".BUCKET_URL.file_key);
  } else {
      ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <title>del.icio.us cache bookmarklet</title>
      </head>
  
      <body>
      <p>Install this bookmarklet to fetch the cache for the webpage you are browsing.</p>
      
      <p><a href="javascript:location.href='
         <?php echo get_this_url() ?>?url='+encodeURIComponent(location.href)">Fetch my del.icio.us cache for this page</a></p>
      </body>
      </html>
      
      <?php
  }
  
  function get_this_url() {
      return "http://"._SERVER['SERVER_NAME'].":"._SERVER["SERVER_PORT"]._SERVER['REQUEST_URI'];
  }
  
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.