/** * @param params a struct containing 3 or more of these key/val pairs: * @param host remote host (required) * @param uri remote uri (required) * @param port remote port (required) * @param method name of method to call * @param args arguments to send (parameters to remote xmlrpc server) * @param debug debug level (0 none, 1, some, 2 more) * @param timeout timeout in secs. (0 = never) * @param user user name for authentication. * @param pass password for authentication * @param secure secure. wether to use fsockopen_ssl. (requires special php build). * @param output array. xml output options. can be null. details below: * @param nodecode if true then don't find_and_decode_xml * * output_type: return data as either php native data types or xml * encoded. ifphp is used, then the other values are ignored. default = xml * verbosity: determine compactness of generated xml. options are * no_white_space, newlines_only, and pretty. default = pretty * escaping: determine how/whether to escape certain characters. 1 or * more values are allowed. If multiple, they need to be specified as * a sub-array. options are: cdata, non-ascii, non-print, and * markup. default = non-ascii | non-print | markup * version: version of xml vocabulary to use. currently, three are * supported: xmlrpc, soap 1.1, and simple. The keyword auto is also * recognized to mean respond in whichever version the request came * in. default = auto (when applicable), xmlrpc * encoding: the encoding that the data is in. Since PHP defaults to * iso-8859-1 you will usually want to use that. Change it if you know * what you are doing. default=iso-8859-1 * * example usage * * $output_options = array('output_type' => 'xml', * 'verbosity' => 'pretty', * 'escaping' => array('markup', 'non-ascii', 'non-print'), * 'version' => 'xmlrpc', * 'encoding' => 'utf-8' * ); * or * * $output_options = array('output_type' => 'php'); */ function xu_rpc_http_concise($params) { $host = $uri = $port = $method = $args = $debug = null; $timeout = $user = $pass = $secure = $debug = $nodecode = null; extract($params); // default values if (!$port) { $port = 80; } if (!$uri) { $uri = '/'; } if (!$output) { $output = array('version' => 'xmlrpc'); } $response_buf = ""; if ($host && $uri && $port) { $request_xml = xmlrpc_encode_request($method, $args); $response_buf = xu_query_http_post($request_xml, $host, $uri, $port, $debug, $timeout, $user, $pass, $secure); if ($nodecode) { $retval = $response_buf; } else { $retval = find_and_decode_xml($response_buf, $debug); } } return $retval; }
/** * @param params a struct containing 3 or more of these key/val pairs: * @param host remote host (required) * @param uri remote uri (required) * @param port remote port (required) * @param method name of method to call * @param args arguments to send (parameters to remote xmlrpc server) * @param debug debug level (0 none, 1, some, 2 more) * @param timeout timeout in secs. (0 = never) * @param user user name for authentication. * @param pass password for authentication * @param secure secure. wether to use fsockopen_ssl. (requires special php build). */ function xu_rpc_http_concise($params) { extract($params); // default values if (!isset($port)) { $port = 80; } if (!isset($uri)) { $uri = '/'; } if (!isset($output)) { $output = array('version' => "xmlrpc"); } $response_buf = ""; if ($host && $uri && $port) { $request_xml = xmlrpc_encode_request($method, $args, $output); $response_buf = xu_query_http_post($request_xml, $host, $uri, $port, $debug, isset($timeout) ? $timeout : '', isset($user) ? $user : '', isset($pass) ? $pass : '', isset($secure) ? $secure : null); $retval = find_and_decode_xml($response_buf, $debug); } return $retval; }