Created
June 8, 2009 00:08
-
-
Save rolandoam/125541 to your computer and use it in GitHub Desktop.
testing xmlrpc on cocos2d forum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xmlrpc is stdlib | |
require 'xmlrpc/client' | |
require 'pp' | |
user = "user" | |
pass = "mypass" | |
url = "http://www.cocos2d-iphone.com/forum/xmlrpc.php" | |
server = XMLRPC::Client.new2(url) | |
# note: this call works even if authentication fails! | |
result = server.call("demo.sayHello", user, pass) | |
pp result | |
# all methods/arguments are here: | |
# http://trac.bbpress.org/browser/trunk/xmlrpc.php | |
#result = server.call("bb.getTopics", user, pass, 2) # 2 is forum id | |
#pp result | |
msg = { | |
'forum_id' => 2, | |
'title' => 'test from xmlrpc', | |
'text' => 'this is a test from xmlrpc', | |
'tags' => 'fake,test' | |
} | |
# msg is just a hash with the required keys | |
result = server.call("bb.newTopic", user, pass, msg) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment