Posting to Wordpress via XMLRPC question

philipk

New member
Joined
Jan 19, 2011
Messages
2
Location
Las Vegas
Programming Experience
3-5
I found some code that lets me post to a Wordpress blog via xmlrpc, but with zero control over categories. I need to be able to post to multiple cats and if possible also address the allow comments and allow trackbacks options for each post. Anybody here that can help.

Hours of Googling has revealed nothing of value.

Here's code I have so far that works for posting to default category.

It's using the Cook.Computing xmlrpc library for dot net that every one talks about.

Before all the subs and functions:
At the very top:
VB.NET:
Imports CookComputing.XmlRpc

Then, just below the Form declaration:

VB.NET:
    Public Structure blogInfo
        Public title As String
        Public description As String
    End Structure

    Public Interface IgetCatList
        <CookComputing.XmlRpc.XmlRpcMethod("metaWeblog.newPost")> _
        Function NewPage(ByVal blogId As Integer, ByVal strUserName As String, ByVal strPassword As String, _
            ByVal content As blogInfo, ByVal publish As Integer) As String
    End Interface

The work is done here:
VB.NET:
    Private Function _
    PostToBlog() _
    As Boolean
        Try
            Dim newBlogPost As blogInfo = Nothing
            newBlogPost.title = "The Best Title Ever"
            newBlogPost.description = "A new blog post for the world to see."
            Dim categories As Object = CType(XmlRpcProxyGen.Create(GetType(IgetCatList)), IgetCatList)
            Dim clientProtocol As Object = CType(categories, XmlRpcClientProtocol)
            clientProtocol.Url = "http://myblog.com/xmlrpc.php"
            Dim result As String = Nothing
            result = categories.NewPage(1, "username", "password, newBlogPost, 1) 
            Say("ALL DONE!")

            Return True
        Catch ex As Exception
            Dim msg As String = "FUNCTION: PostToBlog ::: " _
              & ex.Message & " ::: " _
              & Now.ToString()
            LogError(msg)
            Return False
        End Try
    End Function

Can someone at least show me how to post to multiple categories?

Any help appreciated

Phil
 
Last edited:
Now here is what I find absolutely unbelievable.

Someone writes what is a thoroughly elaborate library for working with xmlrpc on the .NET platform. It becomes the defacto standard.

Do you think that there would be dozens and dozens of examples of how to use this library in every which way for posting to Wordpress, the world's #1 (by the numbers) blogging platform?

I would think so.

Do you think the author himself would put forth such an example?

I would think so.

Instead, the example we get on his website is how to connect to a test math server.

Now tell me, someone, is there a flock of people out there with a need to connect to a math server?

Most people I talk to don't even like math, let alone show any interest in math "servers".

It's like a kid who shows you his toys but doesn't want you to play with them. Forgive me if I'm wrong.

Other examples elsewhere? Google it and prove me wrong.

Now Microsoft chimes in with a full "class" showing how to connect to MSN spaces.

Do you think it would work for Wordpress - considering it's the same metaWeblog api?

Nope. It does not. The Microsoft class yields an "Access denied" error from wordpress.

I hope that someone here can help fill in the blanks.

If we can document this well enough, I will set up a blogger blog showing how to do the whole thing from visual basic.

Not C# - not C++ not Java not PHP

You know, from Visual Basic - the language that became ever so popular even though all the "serious" programmers took it as a joke.

That Visual Basic.

Thanks in advance,
please forgive the rant.

I am so mad about the lack of examples that I could spit, as the saying goes.
 
I agree...I have been trying to post to multiple blogs...I finally tweaked some working code, but it's not the prettiest solution. I had to laugh because that math server example goes beyond ridiculous...I mean, at least from my perspective, I would NEVER need anything like that! lol (or want it for that matter).
 

Latest posts

Back
Top