|
6 | 6 | <body> |
7 | 7 | <h1>Which toolkit demo</h1> |
8 | 8 | <h2>Query server for toolkit information</h2> |
9 | | -<h3>The code demonstrates support for http redirects, the `interopEchoTests.whichToolkit` xml-rpc methods, request compression and use of pre-built xml</h3> |
| 9 | +<h3>The code demonstrates support for http redirects, the `interopEchoTests.whichToolkit` xml-rpc method, request compression and use of pre-built xml</h3> |
10 | 10 | <p>You can see the source to this page here: <a href="which.php?showSource=1">which.php</a></p> |
11 | 11 | '); |
12 | 12 |
|
|
45 | 45 | $encoder = new Encoder(); |
46 | 46 | // from xml to xml-rpc Response |
47 | 47 | $response = $encoder->decodeXml($xml); |
48 | | - // from Response to Value |
49 | | - $value = $response->value(); |
50 | | - // from Value to php |
51 | | - $value = $encoder->decode($value); |
| 48 | + if ($response !== false) { |
| 49 | + // from Response to Value |
| 50 | + $value = $response->value(); |
| 51 | + // from Value to php |
| 52 | + $value = $encoder->decode($value); |
52 | 53 |
|
53 | | - output("Toolkit info:<br/>\n"); |
54 | | - output("<pre>"); |
55 | | - output("name: " . htmlspecialchars($value["toolkitName"]) . "\n"); |
56 | | - output("version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"); |
57 | | - output("docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"); |
58 | | - output("os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"); |
59 | | - output("</pre>"); |
| 54 | + output("Toolkit info:<br/>\n"); |
| 55 | + output("<pre>"); |
| 56 | + output("name: " . htmlspecialchars($value["toolkitName"]) . "\n"); |
| 57 | + output("version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"); |
| 58 | + output("docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"); |
| 59 | + output("os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"); |
| 60 | + output("</pre>"); |
| 61 | + } else { |
| 62 | + output("An xml-rpc error occurred"); |
| 63 | + } |
60 | 64 | } else { |
61 | | - output("An error occurred: "); |
| 65 | + output("An http error occurred: "); |
62 | 66 | output("Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"); |
63 | 67 | } |
64 | 68 |
|
|
0 commit comments