comodojo/metaweblog
, (*1)
A metaweblog rpc client., (*2)
This is the development branch, please do not use it in production, (*3)
This lib is intended to be used as basic client for many blog platforms (such as wordpress) or to generate testing cases for rpc server., (*4)
Installation
Install composer, then:, (*5)
composer require comodojo/metaweblog, (*6)
Usage example
Getting recent posts from a blog:, (*7)
try {
// Create a new metaweblog instance providing address, username and password
$mwlog = new \Comodojo\MetaWeblog\MetaWeblog( "www.example.org", "john", "doe" );
// Get last 10 posts
$posts = $mwlog->getRecentPosts(10);
} catch (\Exception $e) {
/* something did not work :( */
}
Supported methods
This library supports the whole metaweblog API:, (*8)
-
getPost($id): retrieve a post from weblog, (*9)
-
getRecentPosts(/*optional, default 10*/ $howmany): get $howmany posts from blog, (*10)
-
newPost($struct, /*optional, default true*/ $publish): create new post, (*11)
-
editPost($postId, $struct, /*optional, default true*/ $publish): edit post referenced by postId, (*12)
-
deletePost($postId, /*optional, default false*/ $appkey, /*optional, default false*/ $publish): delete a post referenced by postId, (*13)
-
getCategories(): retrieve a list of categories from weblog, (*14)
-
newMediaObject($name, $mimetype, $content, /*optional, default false*/ $overwrite): upload a new media to weblog using metaWeblog.newMediaObject call, (*15)
-
getTemplate($template_type, /*optional, default false*/ $appkey): get template, (*16)
-
setTemplate($template, $template_type, /*optional, default false*/ $appkey): set template, (*17)
-
getUsersBlogs(/*optional, default false*/ $appkey): returns information about all the blogs a given user is a member of, (*18)
Refer to comodojo/metaweblog API for more detailed informations about methods., (*19)
RPC client and transport options
The getRpcClient() method allows access to rpc client options (and also transport options)., (*20)
For example, to get recent post from a blog listening on port 8080:, (*21)
try {
// Create a new metaweblog instance providing address, username and password
$mwlog = new \Comodojo\MetaWeblog\MetaWeblog( "www.example.org", "john", "doe" );
$mwlog->getRpcClient()->getTransport()->setPort(8080);
// Get last 10 posts
$posts = $mwlog->getRecentPosts(10);
} catch (\Exception $e) {
/* something did not work :( */
}
Other setters/getters
Documentation
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details., (*24)
License
comodojo/metaweblog is released under the MIT License (MIT). Please see License File for more information., (*25)