"Metaweblog API" is very usefull when you want to post content automatically or periodically. For example, if you are planning to release news letter by collecting the recent articles on your blog, this is very useful tool.
The below module is available with tistory blog. You can also try to other blogs supporting Metaweblog API. As I mentioned in other article, Microsoft Windows Live Writer is also using this kind of technology to post blog stuffs.
In order to post content by Metaweblog API, you need XMLRPC.inc module on the same working directory.
<?php
//requires XMLRPC.inc from http://phpXMLRPC.sourceforge.net/
require_once('XMLRPC.inc');
$g_blog_url = "http://demoblog.kurapa.com/api/";
$g_id = "kurapa@kurapa.com";
$g_passwd = "*****";
$GLOBALS['XMLRPC_internalencoding'] = 'UTF-8';
function metaWeblog_newPost( $blogid, $title, $content, $tags, $category="")
{
global $g_id;
global $g_passwd;
global $g_blog_url;
$client = new XMLRPC_client( "{$g_blog_url}");
$f = new XMLRPCmsg("metaWeblog.newPost", // metaWeblog.newPost method
array(
new XMLRPCval("{$blogid}", "string"), // blogid.
new XMLRPCval($g_id, "string"), // user ID.
new XMLRPCval($g_passwd, "string"), // password
new XMLRPCval( // body
array(
'title' => new XMLRPCval($title, "base64"),
'description' => new XMLRPCval($content, "base64"),
'category' => new XMLRPCval($category, "base64"),
'mt_keywords' => new XMLRPCval($tags, "base64")
), "struct"),
new XMLRPCval(true, "boolean") // publish
)
);
$f->request_charset_encoding = 'UTF-8';
$response = $client->send($f);
}
metaWeblog_newPost( 0, "test title", "content should be added here", "tag1,tag2");
?>
//requires XMLRPC.inc from http://phpXMLRPC.sourceforge.net/
require_once('XMLRPC.inc');
$g_blog_url = "http://demoblog.kurapa.com/api/";
$g_id = "kurapa@kurapa.com";
$g_passwd = "*****";
$GLOBALS['XMLRPC_internalencoding'] = 'UTF-8';
function metaWeblog_newPost( $blogid, $title, $content, $tags, $category="")
{
global $g_id;
global $g_passwd;
global $g_blog_url;
$client = new XMLRPC_client( "{$g_blog_url}");
$f = new XMLRPCmsg("metaWeblog.newPost", // metaWeblog.newPost method
array(
new XMLRPCval("{$blogid}", "string"), // blogid.
new XMLRPCval($g_id, "string"), // user ID.
new XMLRPCval($g_passwd, "string"), // password
new XMLRPCval( // body
array(
'title' => new XMLRPCval($title, "base64"),
'description' => new XMLRPCval($content, "base64"),
'category' => new XMLRPCval($category, "base64"),
'mt_keywords' => new XMLRPCval($tags, "base64")
), "struct"),
new XMLRPCval(true, "boolean") // publish
)
);
$f->request_charset_encoding = 'UTF-8';
$response = $client->send($f);
}
metaWeblog_newPost( 0, "test title", "content should be added here", "tag1,tag2");
?>
Another posts included in "PHP"
| How to upload attachments such as image by metaWeblog API ? (0) | 2008/01/07 |
| XMLRPC example (0) | 2008/01/07 |
| How to block a connection from the certain site ? (0) | 2008/01/14 |
| Posting to a Wordpress Blog Via XMLRPC Using Blogger API (1) | 2007/12/15 |
| foreach loop (0) | 2007/10/16 |
| Can PHP switch in strings ? (0) | 2007/10/16 |
| PHP Switch Example (0) | 2007/10/16 |
| How to send email in PHP ? (0) | 2007/10/16 |
Trackback : Cannot send a trackbact to this post.
-
Subject Russian incest.
2009/02/11 16:52
Incest motherson. Taboo incest forum.
-
Subject Tramadol wikipedia the free encyclopedia.
2009/05/21 07:42
Tramadol. Tramadol cheap no rx free overnight shipping. What is tramadol.
-
Subject Cheap tramadol.
2009/05/22 07:33
Tramadol ultam.
-
Subject Xanax overdose.
2009/05/25 09:22
Xanax 2 mg 180 pills. No rx online xanax.
-
Subject Valium.
2009/06/01 08:58
Valium side effects. Valium 5mg how long in system. Valium no prescription. No prescription valium. What does valium look like. Buy valium online. Valium.
-
Subject Taking valium while breast feeding.
2009/06/17 06:00
Valium no prescription. Buy valium c.o.d.. Lorazepam to valium conversion. What does valium look like. Valium liquid form. Valium dose appropriate. Valium.
-
Subject different money making ideas
2010/01/28 23:46
moneyideas
-
Subject different money making ideas
2010/01/29 08:10
moneyideas
-
Subject different money making ideas
2010/01/31 16:42
moneyideas

Prev

Rss Feed