Skip to content
Newer
Older
100644 113 lines (88 sloc) 2.52 KB
cf24110 @westonruter Initial commit
authored
1 <?php
2 require_once('RPCServer.class.php');
3
4 //class Point2D {
5 // var $x, $y;
6 // var $label;
7 //
8 // function Point2D($x, $y)
9 // {
10 // $this->x = $x;
11 // $this->y = $y;
12 //
13 // }
14 //
15 // function setLabel($label)
16 // {
17 // $this->label = $label;
18 // }
19 //
20 // function getPoint()
21 // {
22 // return array("x" => $this->x,
23 // "y" => $this->y,
24 // "label" => $this->label);
25 // }
26 //}
27 //
28 //// "$label" is declared but not defined
29 //$p1 = new Point2D(1.233, 3.445);
30 //
31 //$p1->setLabel("point #1");
7704613 @westonruter Fix for XML-RPC in rpc.js
authored
32 date_default_timezone_set(date_default_timezone_get());
cf24110 @westonruter Initial commit
authored
33
34 $server = RPCServer::getInstance();
35 $server->name = "Test JSON/XML-RPC Server";
36 $server->id = "urn:uuid:41544946-415a-495a-5645-454441534646";
37 $server->version = 1.0;
38
39 $server->convertISO8601Strings(true);
40 $server->preserveDefaultParameters(true);
41
42 #$server->useIncludedFunctions(true);
43 #require_once('miscFunctions.php');
44 #$server->addMethod('printBio', 'printBio');
45
46 function passThrough(/*...*/){
47 #throw new Exception("You are an idiot");
48 return func_get_args();
49 }
50 $server->addMethod("passThrough");
51
dd0850d @westonruter Fixes to parameter introspection:
authored
52 function tryDefaultArguments(//$null = null,
53 //$bool = true,
54 //$int = 7,
55 //$float = 3.14,
56 array $array1 = array(),
57 $array2 = array(1, "*", 2),
58 $array3 = array(array(array(array(1,2,3))), array(1,"foo"))
59 )
60 {
61 return func_get_args();
62 }
63 $server->addMethod("tryDefaultArguments");
64
85b8cb0 @westonruter - now using Reflection API if it is available
authored
65
66 function tryTypedParameters(DateTime $dt){
67 return func_get_args();
68 }
69 $server->addMethod("tryTypedParameters");
70
cf24110 @westonruter Initial commit
authored
71 function getServerSource(){
72 return fopen("server.php", 'r');
73 }
74 $server->addMethod("getServerSource");
75
7704613 @westonruter Fix for XML-RPC in rpc.js
authored
76 #require('server.lib.php');
77 #$server->addMethod("foo");
85b8cb0 @westonruter - now using Reflection API if it is available
authored
78
cf24110 @westonruter Initial commit
authored
79 #$server->setJSONDateFormat('ASP.NET');
80 #$server->setJSONDateFormat('classHinting');
81 #$server->setJSONDateFormat('@ticks@');
82 #$server->setJSONDateFormat('ISO8601');
83 #$server->setDBResultIndexType('ASSOC');
84 #$server->setDBResultIndexType('NUM');
85
86 #print json_decode('asdsd"\\s\td\nsd"');
87
7704613 @westonruter Fix for XML-RPC in rpc.js
authored
88 function passThrough2(){
89 return func_get_args();
90 }
91 $server->addMethod("passThrough2", "rpccheck.call"); //, "rpccheck_call"
92
93
cf24110 @westonruter Initial commit
authored
94
95 #print_r(json_decode('{"__jsonclass__":["Date", [455414400000]]}'));
96 #print_r(json_decode('["asd","455414400000"]', true));
97 #print 455414400000;
98
99 #print base64_encode("I am saying, Hello world");
100
7704613 @westonruter Fix for XML-RPC in rpc.js
authored
101
102 function testArgs(){
103
104 return func_get_args();
105
106 }
107 $server->addMethod("testArgs");
108
109
110
111 $server->processRequest();
112
cf24110 @westonruter Initial commit
authored
113 ?>
Something went wrong with that request. Please try again.