Пример
Пример – Basic examples of Services_Delicious
Basic examples of Services_Delicious
The following examples show how to use some basic features of Services_Delicious:
Fetching your recent posts
<?php
require_once 'Services/Delicious.php';
$dlc = &new Services_Delicious($username, $password);
$posts = $dlc->getRecentPosts();
echo '<pre>';
print_r($posts);
echo '</pre>';
?>
Getting all tags that you used in your bookmarks
<?php
require_once 'Services/Delicious.php';
$dlc = &new Services_Delicious($username, $password);
$tags = $dlc->getTags();
echo '<pre>';
print_r($tags);
echo '</pre>';
?>
Adding a new bookmark
<?php
require_once 'Services/Delicious.php';
$dlc = &new Services_Delicious($username, $password);
$result = $dlc->addPost('http://pear.php.net', 'PEAR', 'The PHP Extension and Application Repository', 'php');
if (PEAR::isError($result)) {
die($result->getMessage());
} else {
echo 'Success';
}
?>