Build XMLRPC request to Post to Word Press
Sivakatirswami
katir at hindu.org
Sun Sep 26 02:16:26 EDT 2010
I'm trying to translate a Ruby frame work for posting to Word press
into a Revolution upload script.
I don't know what I'm doing, so this is a fishing expedition (smile) and
tomorrow I will go study the Word Press API and see if it is better
tackling this without Ruby code in the middle of the R & D.
the "listener" on the server is the /blog/myblog/xmlrpc.php
script that handles input.
The API in use by the ruby example we already have working on the server
to post from a web page on the same box via local host, is using the
MetaWebLogAPI.
I think I have cornered the key parts of the script:
Ruby has this function:
-------------------
require xmlrpc/client
def newPost(content, publish)
@client.call('metaWeblog.newPost', @blogid, @username,
@password, content, publish)
end
where content is
content = {
'title' => title,
'description' => post
}
and publish is a boolean string, either "true" or "false"
-----------
I'm assuming I can talk to this xmlrpc.php remotely, assuming the log
in details are here. The ruby library "client.rb" which is required is
over my head completely, but I'm assuming that the RevXMLRPC liberay
should work, if I knew what I was doing, which I don't
I gave it this much of a "stab" and I will later keep plugging away in
the dark if anyone has any ideas, let me know.
on mouseUp
local tRequest
put revXMLRPC_CreateRequest(field "Host",field "Port",field
"Path",field "Protocol") into tRequest
revXMLRPC_AddParam tRequest, "int", "1" # blog ide
revXMLRPC_AddParam tRequest, "string", "user"
revXMLRPC_AddParam tRequest, "string", "password"
revXMLRPC_AddParam tRequest, "string", "metaWeblog.newPost" # I think
the xmlrpc.php needs this...
revXMLRPC_AddParam tRequest, "string", "Testing" # title of the post
revXMLRPC_AddParam tRequest, "string", "Cool article" #
description-article content
revXMLRPC_AddParam tRequest, "string", "false" # send to drafts for
now, don't publish.
put revXMLRPC_Execute(tRequest) into fld "result" # I get a number
put tRequest into fld "result" # I would like to see what the request
looks like but I don't get anything here...
end mouseUp
How do you get LiveCode to show you the full xml that has been built?
That is being sent to the server?
Sivakatirswami
More information about the use-livecode
mailing list