使用VB.NET获取过滤列表Wordpress帖子?

时间:2013-11-12 09:20:33

标签: vb.net wordpress xml-rpc

这是我到目前为止的代码,但我无法理解为什么会出现此错误(错误400)。

我认为问题在于参数过滤器的格式化。有人有什么建议吗?

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

0 个答案:

没有答案