Finally, i decided to release class Ngeblog ver. 001, get it here. It’s the class for accessing Blogger using GData format with PHP. If you want to know how it works, make sure you read my previous short tutorial. I wrapped up the whole code into a single class, hope it would make easier to use.
Currently, it can add, delete and get list of entries from Blogger. I’m trying to add some useful feature like editing entry, draft post and etc.
Here is some examples to use the class:
Add new post
<?php
require_once "Ngeblog.php";
$myblog = new Ngeblog
("yourusername","yourpassword");
$title =
"This is my title";$msg ="<p>This is your <i>content</i></p>";
if ( $myblog->postBlog($title,$msg) ) {
echo "posting success";
} else {
echo "posting failed";
}
?>
Delete an entry
<?php
require_once 'Ngeblog.php';
$myblog = new Ngeblog(
"yourusername",
"yourpassword");
$entryid = '116086019043835900'; // the entry id to be deleted
if (
$myblog->deletePost($entryid) ) {
echo "The entry with id $entryid has been deleted";
}
?>
Get list of entries
<?php
require_once "Ngeblog.php";
$myblog = new Ngeblog("yourusername","yourpassword");
$res = $myblog
->sendQuery(1,5); // this will get five entries from first index
print_r($res);
?>
nice class Eris. 🙂
i was looking for a php class written for blogger API (GDATA). And this is totally what i’m looking for. Thanks so much.
will it support blogger beta soon?