9404803 发表于 2017-3-23 11:50:39

XMLRPC example in PHP

  XMLRPC example in PHP
  转载:http://blog.eood.cn/xmlrpc-example-in-php


  $param=array(“user”=>”test_user”,”host”=>”example.com”,”password”=>”some_password”);
$request = xmlrpc_encode_request(‘check_password’, $param, (array(‘encoding’ => ‘utf-8′)));
  $context = stream_context_create(array(‘http’ => array(
‘method’ => “POST”,
‘header’ => “Content-Type: text/xml\r\n” .
“Content-Length: “.strlen($request),
‘content’ => $request
)));
  $file = file_get_contents(“http://127.0.0.1:1234/RPC2″, false, $context);
  $response = xmlrpc_decode($file);
  if (xmlrpc_is_fault($response)) {
print_r(“error”);
} else {
print_r($response);
}
页: [1]
查看完整版本: XMLRPC example in PHP