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