reference/xmlrpc/functions/xmlrpc-encode-request.xml
3abd17e61d5022d503604cc06894254e3281acf5
...
...
@@ -1,4 +1,4 @@
1
-
<?xml version="1.0" encoding="iso-8859-1"?>
1
+
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
3
<refentry xml:id="function.xmlrpc-encode-request" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
...
...
@@ -72,15 +72,17 @@
72
72
<programlisting role="php">
73
73
<![CDATA[
74
74
<?php
75
-
$request = xmlrpc_encode_request("method", array(1, 2, 3));
76
-
$context = stream_context_create(array('http' => array(
77
-
'method' => "POST",
78
-
'header' => "Content-Type: text/xml",
79
-
'content' => $request
80
-
)));
75
+
$request = xmlrpc_encode_request("method", [1, 2, 3]);
76
+
$context = stream_context_create([
77
+
'http' => [
78
+
'method' => "POST",
79
+
'header' => "Content-Type: text/xml",
80
+
'content' => $request,
81
+
]
82
+
]);
81
83
$file = file_get_contents("http://www.example.com/xmlrpc", false, $context);
82
84
$response = xmlrpc_decode($file);
83
-
if (xmlrpc_is_fault($response)) {
85
+
if ($response && xmlrpc_is_fault($response)) {
84
86
trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
85
87
} else {
86
88
print_r($response);
87
89