Use VB.NET to get a filtered list WordPress posts?

This is the code I have so far, but I can not understand why I am getting this error (Error 400).

I think that the problem is in the formatting of the argument filter. Anyone have any suggestions?

Imports CookComputing.XmlRpc

Public Class Form2

    <XmlRpcUrl("http://example.wordpress.org/xmlrpc.php")> _
    Public Interface IWP
        Inherits IXmlRpcProxy

        <XmlRpcMethod("wp.getPosts")> _
        Function getPosts(ByVal args() As String) As Post()

    End Interface

    Public Structure Post
        Public post_id As String
        Public post_title As String
        Public post_type As String
        '...
    End Structure

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
        Dim args() As String = {"blog_id", "user", "password", "post_type='page'"}
        Dim posts() As Post
        Try
            posts = proxy.getPosts(args)
            For Each post In posts
                ListBox1.Items.Add(post.post_title)
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

End Class

Related posts

Leave a Reply