PEAR::Services::Blogmarks PHP Client
A PHP Client to the blogmarks.net Atom API
This software is beta and is released under the LGPL. While the blogmarks.net Atom Api may change at any time, this library needs to be updated.
Public Methods
- addMark($mark)
- updateMark($id, $mark)
- deleteMark($id)
- getMark($id) return $mark
- getMarksList($params) return $marks
- getTagsList($params) return $tags
$mark is an array with the following values :
- title string (required)
- url string (required)
- description string
- private boolean (default 0)
- tags array
- private_tags array
- via string
The parameters of getMarksList and getTagsList are the same as in the AtomApiSpec.
Example
<?php
$username = "killi";
$password = "XXXXX";
require_once 'Services/Blogmarks.php';
$bm = &new Services_Blogmarks($username, $password);
// Adding a new mark
$mark = array();
$mark['title'] = "Killifishes";
$mark['url'] = "http://www.peixebom.com.br/Killies/killies.htm";
$result = $bm->addMark($mark);
if (PEAR::isError($result)) {
die($result->getCode().':'.$result>getMessage());
}
// Getting the last mark
$params = array();
$params['author'] = $username;
$params['last'] = '1';
$marks = $bm->getMarksList($params);
if (PEAR::isError($marks)) {
die($marks->getCode().':'.$marks->getMessage());
} else {
print_r($marks);
$mark = $marks[0];
}
// Updating the mark with tags and new description
$mark['tags'] = array ( 'test', 'nyfiken', 'i love fishes' );
$mark['description'] = "interesting site !";
$result = $bm->updateMark($mark['id'], $mark);
if (PEAR::isError($result)) {
die($result->getCode().':'.$result>getMessage());
}
// Deleting the mark
$result = $bm->deleteMark($mark['id']);
if (PEAR::isError($result)) {
die($result->getCode().':'.$result>getMessage());
}
?>
PEAR dependencies
- PEAR
- XML::Unseralizer
- -> XML::Parser
- HTTP::Request
- -> NET::Socket
- -> NET::Url
Issues
- X-WSSE nonce encoding will be base64encoded in API next iteration
- sha1 is currently hexadecimal and will be binary in API next iteration
Discuss
...
Attachments
- Blogmarks.php (10.9 kB) - added by znarf on 06/14/05 17:11:28.
- Services_Blogmarks_02.tar.gz (3.1 kB) - added by znarf on 06/14/05 17:11:45.
- Services_Blogmarks_02-package.tar.gz (125.2 kB) - added by znarf on 06/14/05 17:12:00.
