xmlrpc_encode_request

(PHP 4 >= 4.1.0, PHP 5, PHP 7)

xmlrpc_encode_request为 PHP 锟斤拷值锟斤拷锟斤拷 XML

说锟斤拷

xmlrpc_encode_request ( string $method , mixed $params [, array $output_options ] ) : string
Warning

锟剿猴拷锟斤拷锟斤拷实锟斤拷锟斤拷锟侥★拷锟剿猴拷锟斤拷锟侥憋拷锟襟,帮拷锟斤拷锟斤拷锟狡硷拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟� PHP 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷

锟斤拷锟斤拷

method

Name of the method to call.

params

Method parameters compatible with method signature.

output_options

Array specifying output options may contain (default values are emphasised):

  • output_type: php, xml

  • verbosity: no_white_space, newlines_only, pretty

  • escaping: cdata, non-ascii, non-print, markup (may be a string with one value or an array with multiple values)

  • version: simple, xmlrpc, soap 1.1, auto

  • encoding: iso-8859-1, other character set supported by iconv

锟斤拷锟斤拷值

Returns a string containing the XML representation of the request.

锟斤拷锟斤拷

Example #1 XMLRPC client functions example

<?php
$request 
xmlrpc_encode_request("method", array(123));
$context stream_context_create(array('http' => array(
    
'method' => "POST",
    
'header' => "Content-Type: text/xml",
    
'content' => $request
)));
$file file_get_contents("http://www.example.com/xmlrpc"false$context);
$response xmlrpc_decode($file);
if (
$response && xmlrpc_is_fault($response)) {
    
trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    
print_r($response);
}
?>

锟轿硷拷

  • stream_context_create() - 锟斤拷锟斤拷锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷
  • file_get_contents() - 锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷一锟斤拷锟街凤拷锟斤拷
  • xmlrpc_decode() - 锟斤拷 XML 锟斤拷锟斤拷为 PHP 锟斤拷锟斤拷锟斤拷锟斤拷锟�