imred

Hey guys,

I am just stuck on this one...  I created a way to post content to my blogs from vb

.net

  without issue using XML-RPC.  However, the problem is that I cannot get it to go to a particular category nor utilize tagging Applause

Anyone have any code to do this?  Here is my code for posting to Wordpress:

---------------------------------------------------------------------------
<XmlRpcUrl("http://www.myblogurlgoeshere.com/xmlrpc.

php

 "Applause> _
    Public Interface IWP
        Inherits IXmlRpcProxy

        <XmlRpcMethod("blogger.newPost"Applause> _
        Function newPost(ByVal args() As String) As Integer
    End Interface


In a button-click event (eventually on a timer):

        Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
        Dim args() As String = {"", "", "{usernamehere}", "{passwordhere}", {postcontenthere}, "publish"}
        errorreturn = proxy.newPost(args)

---------------------------------------------------------------------------


Any ideas on how I can get Category and Tags into the mix on thisApplause  Also I am looking for one other thing if anyone has some code they can lend Applause

I need to take content and replace words using a synonym database... I can figure it out myself, but would prefer to have some good code to start with Applause

Thanks in advance!

vsloathe

The beauty of XMLRPC is that it is whatever you tell it to be. Check the docs of WP's XMLRPC, I went through this same headache a while ago. The answer is yes, if WP allows you to choose category and tagging.

I will check some of my docs from when I was banging my head against the wall with this and let you know what I find. I was doing mine in

PHP

 , but an XMLRPC packet is an XMLRPC packet is an XMLRPC packet.

vsloathe

Ok, looks like what I did was this:

Inside your "post content" field, you can use tags to specify the category, etc.

This is how I was doing it in

PHP

 :


<?

php

 
$client = new xmlrpc_client($xmlrpcurl);
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval($username);            //your wordpress login
$params[] = new xmlrpcval($password);        //your wordpress password
$params[] = new xmlrpcval(
"<title>Title</title>".            //the title of your post
"<category>Category</category>".    //the category
$body);                                //the body
$params[] = new xmlrpcval("true");          //publish now = true
?>

DangerMouse

Wordpress supports Blogger, MetaWeblog and MovableType (I think) APIs, so if you concentrate your search there you should be able to find out the correc xmlrpc methods and the correct structure for your xml.

I'm pretty sure there is a way to call some kind of reflection command on the Wordpress xmlrpc.

php

  file aswell, this will detail all the xmlrpc methods supported, but I don't recall where I saw that sorry.

DM

imred

I think I am seeing the problem...

I decided to use Cook Computing's XMLRPC wrapper... Because of this, I am allowing them to create the XML packet.  And, since this is the case, I am having a difficult time sending over different information.

I'll have to re-think this approach and possibly use an alternative method with vb

.net

 .

thanks guys!  That DID help.

imred

quote author=DangerMouse link=topic=818.msg5608#msg5608 date=1204924766

Wordpress supports Blogger, MetaWeblog and MovableType (I think) APIs, so if you concentrate your search there you should be able to find out the correc xmlrpc methods and the correct structure for your xml.

I'm pretty sure there is a way to call some kind of reflection command on the Wordpress xmlrpc.

php

  file aswell, this will detail all the xmlrpc methods supported, but I don't recall where I saw that sorry.

DM


I did look, pretty heavily into that file (xmlrpc.

php

 Applause.  In fact, I went so far as to change it around to more easily send my own timestamp (to allow post-dating and dating for earlier posts) as well as Titles. 

I think I know it pretty good, it's just the way it extracts everything... and since I wasn't creating the XML myself, I really didn't think about it Applause  Now that I am thinking about it, I can see the command which extracts the categories out of the XML in the functions

php

  file.

imred

ok, I got it (at least adding a title and putting it into a category).

Using the Blogger API for new post, you have to have:

<category>3</category>

instead of the actual name of the category Applause

DangerMouse

I believe theres a method from the blogger api that will allow you to return all the available categories, so it should be possible to grab the number from that rather than having to know it before hand.

DM

nutballs

actually if you hit the mt_keywords method in the rpc it will just add what you send as tags. not categories, but then again, you dont have to dick with the stupid categories silliness that goes on in there, as you discovered. tags are good enough imo.

imred

Thanks Dangermouse - yes, there is the categories piece that I am using, but it brings back the category name Applause  That was why I had such problems - I thought I was doing it right!  Applause

Nutballs - that sounds like a good idea.  I get more out of tagging than categories anyway.  Thanks!


Perkiset's Place Home   Politics @ Perkiset's