topical media & game development 
  
 
 
 
 
  
    
    
  
 server-webapi-code-11-delicious.php / php
  <?php
  
  require("../common_db.php");
  
  if (endPoint = "http://del.icio.us/api/posts/add?";
    parameters[] = array('url', urlencode(parameters[] = array('extended', urlencode(parameters[] = array('tags', urlencode(parameters[] = array('description', urlencode(parameters[] = array('dt', date("Y-m-jTH:i:sZ"));
    endPoint, endPoint = "http://del.icio.us/api/tags/get?";
    endPoint, array());  
    xml as usedTags[] = usedTags);
    usedTags);
    
    echo <<< htmlCodeBlock
    <form method="post">
    <input type="hidden" name="method" value="add">
    URL: <input type="text" name="url"><br>
    Extended: <input type="text" name="extended"><br>
    Descirption:<input type="text" name="description"><br>
    Tags:<input type="text" name="tags"><br>
    Previously Used Tags: xml as post['description']} at {post['tag']}\n";
    }
    */  
  function callDelicious(parameters)
  {
    foreach (paramater)
    {
            paramater[0] . "=" . endPoint;
    
    endPoint);
    query = "SELECT `key`, `xml` FROM 11_delicious_cache WHERE `key` = 'today' ORDER BY `tstamp` DESC LIMIT 1";
    query, 0);
    
    if (isset(xml']))
    {
      //echo "Cache copy is valid";
      result['xml']); 
    }else 
    {
       endPoint);
       if (xml == "THROTTLE")
       {
         // Throttled, get best possible
           key' ORDER BY `tstamp` DESC LIMIT 1";
           query, 0);
           if (isset(safeXML = mysql_real_escape_string(insertQuery = "REPLACE INTO 11_delicious_cache (`key`, `xml`, `tstamp`) VALUES (MD5('safeXML', null)";
             insertQuery(xml = simplexml_load_string(xml = null; 
           }
           
       }else if (is_object(safeXML = mysql_real_escape_string(insertQuery = "REPLACE INTO 11_delicious_cache (`key`, `xml`, `tstamp`) VALUES (MD5('safeXML', null)";
         insertQuery(xml = null;
       }
    }
    return endPoint)
  {
   
    url_info = parse_url(host = path = url_info['query'];  
    fp=fsockopen(fp, "POST " . fp, "Host: " . fp, "Authorization: Basic fp, "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain\r\n");
    fputs(fp, "Connection: close\r\n");
    fputs(fp, "Content-Type: application/x-www-form-urlencoded\r\n");
    fputs(data) . "\r\n\r\n");
    fputs(data");
  
    fp))
    {
      fp, 128);
    }
    fclose(http_headers, response);
    if (strpos(firstLine = strpos(http_content = substr(firstLine + 1);
      http_content, ">");
      http_content, 0, xml = simplexml_load_string(http_content</pre>";
      return http_headers, "503"))
    {
      return "THROTTLE";
    }else 
    {
      return NULL;
    }
  }
  
  ?>
  
  
(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.