ProjectX client-side code
In this example the password is stored on the server not for authentication but simply to provide a reminder service in the event the user forgets it.
require 'net/http' require 'rexml/document' include REXML class ProjectXClient attr :doc def initialize(raw_url) url = URI.escape(raw_url) xml_data = Net::HTTP.get_response(URI.parse(url)).body @doc = Document.new(xml_data) end end if __FILE__ == $0 xml_project = <<PROJECT <project name='password'> <method name='create'> <params> <param var='password' val='p6789c'/> <param var='title' val='hotmail'/> </params> </method> </project> PROJECT pxc = ProjectXClient.new("http://yourdomain.com/p/projectx.cgi?xml_project=" + xml_project) doc = pxc.doc puts doc end
output -what's returned from the server is an XML response containing a result. The result echos the method executed and the output from that method, which in this instance is the xml record node 'entry'.
<result method='rtn_create'> <append id='19367'> <entry id='19367'> <password>p6789c</password> <title>hotmail</title> <description/> </entry> </append> </result>