VB.NETから
xml-rpc.NETを使ってxml-rpc対応のブログを更新するコード。
FC2ブログで更新できることを確認。
サーバー側が対応してるAPI調べるのが大変だ。
Imports CookComputing.XmlRpc
Public Structure content
Public title As String
Public description As String
Public dateCreated As System.DateTime
End Structure
<XmlRpcUrl("http://blog.fc2.com/xmlrpc.php")> _
Public Interface ProxtFc2
Inherits IXmlRpcProxy
<XmlRpcMethod("metaWeblog.newPost")> _
Function newPost( _
ByVal blogid As String, _
ByVal username As String, _
ByVal password As String, _
ByVal content As content, _
ByVal publishu As Boolean) As Object
End Interface
Module module1
Sub Main()
Dim blogID As String = "hoge"
Dim userName As String = "foo"
Dim password As String = "hoo"
Dim proxy As ProxtFc2
proxy = CType(XmlRpcProxyGen.Create(GetType(ProxtFc2)), ProxtFc2)
Dim pst As content
pst.dateCreated = Now
pst.description = "post test 投稿テスト"
pst.title = "post test"
Dim rtn As String
rtn = proxy.newPost(blogID, userName, password, pst, True).ToString
Console.WriteLine(rtn)
End Sub
End Module