This class is a set of PHP functions to access
del.icio.us web service API. Use this class to easily manage your posts
and do some other cool stuff on del.icio.us.
This class is a set of PHP functions to access del.icio.us web service
API. Use this class to easily manage your posts and do some other cool
stuff on del.icio.us.
Requirement:
Features:
- Support proxy
- Access all of del.icio.us API
Usage Samples
Here are some examples. For the full list of available functions, consult reference.html included in the package.
1. Get your recent post at del.icio.us:
Listing 1: listing-1.php
-
<?php
-
include "DeliciousBrownies.php";
-
-
$d = new DeliciousBrownies;
-
$d->setUsername("myusername");
-
$d->setPassword("mypassword");
-
$res = $d->getRecentPosts();
-
-
if (!$res) {
-
print "something went wrong";
-
-
-
-
/*
-
outputs something like this:
-
Array
-
(
-
[0] => Array
-
(
-
[href] => http://www.nashruddin.com/pub/free-php-scripts.html
-
[description] => PHP scripts, tips n tricks, code snippets
-
[extended] => PHP scripts, tips n tricks, code snippets
-
[hash] => 9bfe73757a108356d25c3b8fcb3b3e3a
-
[tag] => php-scripts code-snippets php-tips-n-tricks
-
[time] => 2008-04-20T05:48:16Z
-
)
-
-
[1] => Array
-
(
-
[href] => http://www.nashruddin.com/
-
[description] => Computer vision & PHP resources
-
[extended] => Nashruddin'd blog, computer vision, php scripts
-
[hash] => 057594308f84a4d3b35e0bc08a25af67
-
[tag] => computer-vision php-scripts code-snippets
-
[time] => 2008-04-20T05:47:55Z
-
)
-
)
-
*/
-
?>
2. Add a post to del.icio.us:
Listing 2: listing-2.php
-
<?php
-
include "DeliciousBrownies.php";
-
-
$url = "http://www.google.com";
-
$desc = "Search the web";
-
$tags = "search-engine groups";
-
$notes = "Best search engine, try it!";
-
-
$d = new DeliciousBrownies;
-
$d->setUsername("myusername");
-
$d->setPassword("mypassword");
-
$d->addPost($url, $desc, $tags, $notes);
-
?>
3. You can also query your database and post them to del.icio.us. Maybe something similar to this:
Listing 3: listing-3.php
-
<?php
-
include "DeliciousBrownies.php";
-
-
/* setup client */
-
$d = new DeliciousBrownies;
-
$d->setUsername("myusername");
-
$d->setPassword("mypassword");
-
-
/* get articles */
-
$result = mysql_query ("select url, desc, tags, notes from articles");
-
-
while($row = mysql_fetch_object ($result)) {
-
$url = $row->url;
-
$desc = $row->desc;
-
$tags = $row->tags;
-
$notes = $row->notes;
-
-
/* post 'em all */
-
$d->addPost($url, $desc, $tags, $notes);
-
}
-
?>
|