例 – Services_Delicious の基本的な例

Services_Delicious の基本的な例

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>';
?>

あなたの使用するブックマークから全てのタグを取得します。

<?php
require_once 'Services/Delicious.php';
    
$dlc = &new Services_Delicious($username$password);

$tags $dlc->getTags();
echo 
'<pre>';
print_r($tags);
echo 
'</pre>';
?>

新しいブックマークを加えます。

<?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';
}
?>