OSDN Git Service

merged 3.15rc3 modification
[nucleus-jp/nucleus-jp-ancient.git] / euc / build / testcases / xmlrpc-metaWeblog-newPost.php
1 <?php\r
2 /*\r
3         Test call to the nucleus XML-RPC server sending a metaWeblog.getRecentPosts request\r
4         \r
5         \r
6 */\r
7 \r
8 // URL of XML-RPC server\r
9 $serverHost = 'localhost';\r
10 $serverPort = 8080;\r
11 $serverPath = '/nucleus/nucleus/xmlrpc/server.php';\r
12         \r
13 include('../../config.php');\r
14 include($DIR_LIBS . 'xmlrpc.inc.php');\r
15 \r
16 $f=new xmlrpcmsg(\r
17         'metaWeblog.newPost',\r
18          array(\r
19                 new xmlrpcval('1', 'string'),                   // itemid\r
20                 new xmlrpcval('god', 'string'),                 // username\r
21                 new xmlrpcval('heaven', 'string'),              // password\r
22                 new xmlrpcval(                                                  // post info\r
23                         array(\r
24                                 'description' => new xmlrpcval('Just a test','string'),\r
25                                 'title' => new xmlrpcval('Edit Post Test', 'string'),\r
26                                 'categories' => new xmlrpcval(array(), 'array')\r
27                         ),'struct'),\r
28                 new xmlrpcval(1, 'boolean'),                    // publish\r
29          )\r
30  );\r
31          \r
32   $c=new xmlrpc_client($serverPath, $serverHost, $serverPort);\r
33   $c->setDebug(1);\r
34   $r=$c->send($f);\r
35   $v=$r->value();\r
36 \r
37 \r
38   if (!$r->faultCode()) {\r
39         echo 'success!';\r
40   } else {\r
41       print "Fault: ";\r
42       print "Code: " . $r->faultCode() . \r
43             " Reason '" .$r->faultString()."'<BR>";\r
44   }\r
45         \r
46 \r
47         \r
48 ?>