postWordPress.rb
def postWordPress
user = 'user'
post = 'post'
date = Time.parse('2012/01/01 10:00')
publish = 0 #0:下書き,1:公開
description = '内容'
server = XMLRPC::Client.new('sample.com', '/xmlrpc.php') #/(スラッシュ)は必須
struct = {
'title' => 'title',
'description' => description,
'dateCreated' => date
}
id = server.call("metaWeblog.newPost",1,user,pass,struct,publish)
puts "Posted ID: #{ID}"
end
xmlrpc.phpの指定の直前のスラッシュは指定がないと400 Bad Requestが出てしまう
post.rb
load postWordPress
postWordPress
で投稿可能