juust ~ php oddities

Unordered list of one element
  • rss
  • begin
  • about
    • vcard
    • WTF is BroJesus
  • php scripts
    • flickr wp widget
    • google multi key serp tool, php script
    • gwt plugin
  • php classes
    • php pagerank class
    • fibonacci class
    • robots.txt parser php class
  • serp
    • serp dashboard wordpress plugin
  • services

xml rpc – remote posting with incutio wordpress ixr class

juust | 02/11/2008

In order to build a successful blog network I need xml-rpc. I read up on xml-rpc, incutio ixr and tried some basic flat file xml rpc. It’s either that or a custom php url to post data to and then use the wordpress functions to process it.

Xml-rpc is a lot easier especially with the Wordpress Incutio-IXR class:

  1. include_once('wp-includes/class-IXR.php');
  2.  
  3. //just give us your endpoint and we'll take it from there Sparky…
  4. $client = new IXR_Client('http://tryout.blacknorati.com/xmlrpc.php');
  5.  
  6. // xml rpc post function form :
  7. // metaWeblog.newPost( blog_id, username, password, struct, publish )
  8.  
  9. //struct = structure for post data
  10.  $post['title'] = 'test titel';
  11.  $post['description'] = 'test';
  12.  $post['categories'] = array("frontpage");
  13.  
  14. //use 'query' to interact with the server, set publish to 0 (draft) for now
  15.  if (!$client->query('metaWeblog.newPost', 6, 'user', 'password', $post, 0)) {
  16.  die('Something went wrong – '.$client->getErrorCode().' : '.$client->getErrorMessage());
  17.  }
  18.         echo $client->getResponse();

Normally getResponse will return a PostID for this function.

Is it really that simple ? Yes. I skipped to the IXR_Client because my host does not have xmlrpc running and the IXR_class doesn’t use it, and solutions with email don’t easily allow access to tags and categories.

  1. $post['categories'] = array("frontpage");
  2. $post['mt_keywords']='key1, key2';
  3. $post["mt_allow_comments"] ='closed';
  4. $post['mt_allow_pings']='open';
  5. //$post['mt_tb_ping_urls'] ='url url url';
  6. //$post['enclosure']=array('url', 'length', 'type')';

mt_keywords holds my tags, that’s a bit more flexible than categories. For my blogs the comments are closed (mt_allow_comments), mt_allow_pings is open, and the real tasty bit is the trackbacks (mt_tb_ping_urls : simply urls separated with a blank space, just like in the wordpress form). I played with the Arrousi trackback class, that one has an autodiscover routine, so I can try and fetch a trackback url from the content page I am ‘using’.

I don’t work with enclosures, but to be complete I added it here.

That covers most data I want to send around a blog network. Very nice class, Incutio IXR.

Next week : more nonsense.

[Post to Twitter] Tweet This  [Post to Plurk] Plurk This  [Post to Yahoo Buzz] Buzz This  [Post to Delicious] Delicious This  [Post to Reddit] Reddit This 

Categories
wordpress, xml-rpc
Tags
wordpress, xml-rpc
Comments rss
Comments rss
Trackback
Trackback

« How to grab keywords from 7search serp tool »

One Response to “xml rpc – remote posting with incutio wordpress ixr class”

  1. wp-popular.com » Blog Archive » juust ~ php oddities » xml rpc – remote posting with incutio wordpress ixr class says:
    19/02/2010 at 5:26 am

    [...] the original: juust ~ php oddities » xml rpc – remote posting with incutio wordpress ixr class Tags: xml-rpc, [...]

    Reply

Leave a Reply

Click here to cancel reply.

Recent Posts

  • p2p with wordpress xml-rpc
  • Tweets on Google’s frontpage
  • happy new year
  • metaWeblog.newPost posting to Wordpress from Word
  • IE is retarded

click me!
rss
Comments rss
Blog Directory
Web Developement Blogs - BlogCatalog Blog Directory
Listed in LS Blogs the Blog Directory and Blog Search Engine
Blog Flux Directory
joopita.com free web directory and search engine
design by jide
sitemap
8298 confirmed spam kills