Search results for 'PHP Tistory Posting'. 1 post(s) found.

  1. 2008/01/02 How to post blog content by metaweblog API ? (3)
2008/01/02 15:59

How to post blog content by metaweblog API ?


"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");

?>

Trackback 9 Comment 3

Trackback : Cannot send a trackbact to this post.

  1. Subject Russian incest.

    Tracked from Incest forum. 2009/02/11 16:52 delete

    Incest motherson. Taboo incest forum.

  2. Subject Tramadol wikipedia the free encyclopedia.

    Tracked from Tramadol fda. 2009/05/21 07:42 delete

    Tramadol. Tramadol cheap no rx free overnight shipping. What is tramadol.

  3. Subject Cheap tramadol.

    Tracked from Tramadol. 2009/05/22 07:33 delete

    Tramadol ultam.

  4. Subject Xanax overdose.

    Tracked from Xanax. 2009/05/25 09:22 delete

    Xanax 2 mg 180 pills. No rx online xanax.

  5. Subject Valium.

    Tracked from Valium side effects. 2009/06/01 08:58 delete

    Valium side effects. Valium 5mg how long in system. Valium no prescription. No prescription valium. What does valium look like. Buy valium online. Valium.

  6. Subject Taking valium while breast feeding.

    Tracked from Valium 5mg how long in system. 2009/06/17 06:00 delete

    Valium no prescription. Buy valium c.o.d.. Lorazepam to valium conversion. What does valium look like. Valium liquid form. Valium dose appropriate. Valium.

  7. Subject different money making ideas

    Tracked from moneyideas 2010/01/28 23:46 delete

    moneyideas

  8. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 08:10 delete

    moneyideas

  9. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:42 delete

    moneyideas