WARNING AND NOTICE

All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.

Readmore

Thursday, September 23, 2010

Description of PHP-RPC protocol

The primary goal of this protocol is to provide a simple, light-weight and most imortantly, fast mechanisam for making remote procedure calls (RPC)for pure PHP applications. Consequently, portability to non-PHP applications is not of significance. The protocol uses PHP’s serialize() and unserialize() calls, with base64 encode() and base64 decode() fortransport-armour when needed. Because of this, any non-resource PHP data type can be used with no overhead for type-juggling. The underlaying transport mechanismis HTTP.The dynamics of protocol usage is purely call-and-response, with no innatestatetracking (which is left to higher-level systems to implement if needed).Thus it is very simple and at the same time very powerful for real-world usage. 2 Making PHP-RPC calls Firstly, we’ll introduce the notion of a PHP-RPC function identifier. It is a URIwhich completely and uniquely identifies one PHP-RPC function. It is of the form http://web.site.com/somedir/phpfile.php?function name(par1,par2). ThisURI references PHP function function name() in file phpfile.php, that resideson web site www.site.com/somedir, and specifies that the function will receivepar1 and par2 as it’s parameters.There are two forms of PHP-RPC calls and they are distinguished by thefunction name part of the URI. The first one is when the function name endsin underline (“ ”): then each of the parameters in the URI is base64-encodedoutput from serialize() of the PHP value intended to be passed as the parameter(the “ ” is stripped from the function name before making the actual call). Thesecond form is specified by function name ending without “ ”, in which casethe parameters are in human-readable form (e.g. “string”, 1234, true). Thefunctions intended to be called by PHP-RPC can never have names endingin “ ”. Note that in the first case, any PHP serializable value can be passed,but in the second case, only string, numeric and boolean values can be used asparameters. String values must be enclosed in double quotes and in the case theythemselves contain double quotes, the inner quotes must be backslash-escaped.There must not be any extra white space in any of the call forms.Result of the function is always returned as a serialized PHP value, in thebody of HTTP response. The result is not automatically base64 encoded, rather it depends of the Transfer-Encoding and other HTTP reply headers.A raw-text dump of HTTP protocol traffic for an example PHP-RPC call is:GET /somedir/phpfile.php?multiply(2,5) HTTP/1.0]HTTP/1.0 200 OKi:10;And this is all there is to it. Notice that the protocol accomplishes its goals:• It has a much smaller footprint than XML-RPC• It is also much faster, as it avoids complex creation and parsing of XML structures 3 Reference implementation The reference implementation(found at http://geri.cc.fer.hr/˜ivoras/) contains these functions:prpc($fun_uri,[$arg1,...])prpc_($fun_uri,[$arg1,...])The above functions will perform a PHP-RPC call to function identified by URIin $fun uri, with variable number of parameters, and will return its result. Thefirst function will make the call using the human-readable form (the first case described in section

Download
Description of PHP-RPC protocol.

0 comments:

Post a Comment