+<?php\r
+/*\r
+ Test call to the nucleus XML-RPC server sending a metaWeblog.newMediaObject request\r
+ \r
+ Wouter Demuynck / 2003-08-31\r
+*/\r
+\r
+// URL of XML-RPC server\r
+$serverHost = 'localhost';\r
+$serverPost = 80;\r
+$serverPath = '/release/nucleus/xmlrpc/server.php';\r
+ \r
+include('../../config.php');\r
+include($DIR_LIBS . 'xmlrpc.inc.php');\r
+\r
+// get file data\r
+$filename = '../../nucleus/nucleus.gif';\r
+$fh = fopen($filename,'rb');\r
+$data = fread ($fh, filesize ($filename));\r
+fclose($fh);\r
+\r
+$f=new xmlrpcmsg(\r
+ 'metaWeblog.newMediaObject',\r
+ array(\r
+ new xmlrpcval('1', 'string'), // blogid\r
+ new xmlrpcval('god', 'string'), // username\r
+ new xmlrpcval('heaven', 'string'), // password\r
+ new xmlrpcval(array( // data\r
+ 'name' => new xmlrpcval('myImage.gif', 'string'),\r
+ 'type' => new xmlrpcval('image/gif', 'string'),\r
+ 'bits' => new xmlrpcval($data, 'base64')\r
+ ), \r
+ 'struct'\r
+ )\r
+ )\r
+ );\r
+ \r
+\r
+ $c=new xmlrpc_client($serverPath, $serverHost, $serverPort);\r
+ $c->setDebug(1);\r
+ $r=$c->send($f);\r
+ $v=$r->value();\r
+\r
+\r
+ if (!$r->faultCode()) {\r
+ echo 'succes!';\r
+ } else {\r
+ print "Fault: ";\r
+ print "Code: " . $r->faultCode() . \r
+ " Reason '" .$r->faultString()."'<BR>";\r
+ }\r
+ \r
+\r
+ \r
+?>
\ No newline at end of file