PEAR::Services::Blogger PHP Client
A PHP Client to the Blogger Atom API
This software is beta and is released under the LGPL. While the Blogger Atom Api may change at any time, this library needs to be updated.
Public Methods
- addEntry($entry)
- updateEntry($id, $entry)
- deleteEntry($id)
- getEntry($id) return $entry
- getEntries() return $entries
In input $entry is an array with the following values :
- title : string
- content : string
- issued : date
In output, there are more :
- service.edit : string
- alternate : string
- id : int
Example
<?php
$blogid = "777";
$username = "znarf";
$password = "XXXXX";
require_once 'Services/Blogger.php';
$blogger = &new Services_Blogger($blogid, $username, $password);
// Adding an entry
$entry = array();
$entry['title'] = "Hello world !";
$entry['content'] = "Some content";
$result = $blogger->addEntry($entry);
if (PEAR::isError($result)) {
die($result->getCode().':'.$result>getMessage());
}
// Getting last entries
$entries = $blogger->getEntries();
if (PEAR::isError($entries)) {
die($entries->getCode().':'.$entries->getMessage());
} else {
print_r($entries);
}
// Deleting an entry
$result = $blogger->deleteEntry('7899546');
if (PEAR::isError($result)) {
die($result->getCode().':'.$result>getMessage());
}
?>
External examples
- Simple example of getting a single entry : See blog post by Bill Lazar
PEAR dependencies
- PEAR
- XML::Unseralizer
- -> XML::Parser
- HTTP::Request
- -> NET::Socket
- -> NET::Url
Issues
- can just parse the 15 last items
- you may have to disactive automatic line/breaks feature
Discuss
...
Attachments
- Services_Blogger_03.zip (2.7 kB) - added by znarf on 06/15/05 14:47:06.
- Services_Blogger_03-package.zip (154.5 kB) - added by znarf on 06/15/05 14:47:19.
- Blogger.php (11.2 kB) -
0.3.2
, added by znarf on 08/01/05 17:12:45.
